From e9e7bb356e0cb0bb90a6d2d8e55e998a60dfd936 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Wed, 21 Sep 2022 10:37:23 +0700 Subject: [PATCH] chore(config): use iceberg for neovim --- data/nvim/init.lua | 277 ++++++++++++++++++--------------------------- 1 file changed, 111 insertions(+), 166 deletions(-) diff --git a/data/nvim/init.lua b/data/nvim/init.lua index 6219d23..800813e 100644 --- a/data/nvim/init.lua +++ b/data/nvim/init.lua @@ -1,194 +1,139 @@ -- https://github.com/nanotee/nvim-lua-guide +vim.opt.completeopt = { "menuone", "noinsert", "noselect" } +vim.opt.swapfile = false +vim.opt.title = true vim.opt.virtualedit = "block" vim.opt.whichwrap = "<,>,[,]" --- https://github.com/vscode-neovim/vscode-neovim -if not vim.g.vscode then - vim.opt.completeopt = { "menuone", "noinsert", "noselect" } - vim.opt.swapfile = false - vim.opt.title = true +-- Line number +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 4 - -- Line number - vim.opt.number = true - vim.opt.relativenumber = true - vim.opt.scrolloff = 4 +-- Tab +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true - -- Tab - vim.opt.tabstop = 4 - vim.opt.shiftwidth = 4 - vim.opt.expandtab = true +-- Wrap +vim.opt.breakindent = true - -- Wrap - vim.opt.breakindent = true +-- Truecolor +if vim.env.COLORTERM == "truecolor" then + vim.opt.termguicolors = true +end - -- Truecolor - if vim.env.COLORTERM == "truecolor" then - vim.opt.termguicolors = true - end +-- Clipboard support +vim.opt.clipboard:append({ "unnamedplus" }) - -- Clipboard support - vim.opt.clipboard:append({ "unnamedplus" }) +-- Mouse support +vim.opt.mouse = "a" - -- Mouse support - vim.opt.mouse = "a" +-- Workaround +-- https://github.com/neovim/neovim/issues/16416 +vim.keymap.set("i", "", "") - -- GUI support - vim.opt.guifont = { - "APL385 Unicode:h18", - "Agave:h18", - "Victor Mono:h18", - "Rec Mono Casual:h18", - "Cascadia Code:h18", - "JetBrains Mono:h18", - "Iosevka:h18", - "Fira Code:h18", - } +-- Disable showmode when use lualine +vim.opt.showmode = false - -- Workaround - -- https://github.com/neovim/neovim/issues/16416 - vim.keymap.set("i", "", "") +-- Keymap +vim.keymap.set("n", "s", ":w") +vim.keymap.set("n", "q", ":FZF") +vim.keymap.set("n", "", ":NvimTreeToggle") +vim.keymap.set("n", "r", ":NvimTreeRefresh") +vim.keymap.set("n", "n", ":NvimTreeFindFile") +vim.keymap.set("n", "z", ":TZAtaraxis") +vim.keymap.set("n", "f", ":Neoformat") - -- Disable showmode when use lualine - vim.opt.showmode = false +-- Use vim-go +vim.g.go_gopls_gofumpt = 1 +vim.g.go_doc_popup_window = 1 - -- Keymap - vim.keymap.set("n", "s", ":w") - vim.keymap.set("n", "q", ":FZF") - vim.keymap.set("n", "", ":NvimTreeToggle") - vim.keymap.set("n", "r", ":NvimTreeRefresh") - vim.keymap.set("n", "n", ":NvimTreeFindFile") - vim.keymap.set("n", "z", ":TZAtaraxis") - vim.keymap.set("n", "f", ":Neoformat") +-- Use copilot +vim.g.copilot_filetypes = { + ["*"] = false, + go = true, + proto = true, + yaml = true, +} - -- Use catppuccin - vim.g.catppuccin_flavour = "mocha" +-- Use fzf +vim.opt.rtp:append({ "~/.fzf" }) - -- Use vim-go - vim.g.go_gopls_gofumpt = 1 - vim.g.go_doc_popup_window = 1 +-- https://github.com/wbthomason/packer.nvim +require("packer").startup(function() + -- Manage itself + use("wbthomason/packer.nvim") - -- Use copilot - vim.g.copilot_filetypes = { - ["*"] = false, - go = true, - proto = true, - yaml = true, - } + -- https://github.com/axelf4/vim-strip-trailing-whitespace + use("axelf4/vim-strip-trailing-whitespace") - -- Use fzf - vim.opt.rtp:append({ "~/.fzf" }) + -- https://github.com/nvim-lualine/lualine.nvim + use({ + "nvim-lualine/lualine.nvim", + config = function() + require("lualine").setup({ + options = { + icons_enabled = false, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + }, + extensions = { "fzf", "nvim-tree" }, + }) + end, + }) - -- https://github.com/wbthomason/packer.nvim - require("packer").startup(function() - -- Manage itself - use("wbthomason/packer.nvim") - - -- https://github.com/axelf4/vim-strip-trailing-whitespace - use("axelf4/vim-strip-trailing-whitespace") - - -- https://github.com/nvim-lualine/lualine.nvim - use({ - "nvim-lualine/lualine.nvim", - config = function() - local lualine_theme = require("lualine.themes.iceberg") - if vim.opt.termguicolors then - lualine_theme = require("lualine.themes.catppuccin") - end - - require("lualine").setup({ - options = { - icons_enabled = false, - theme = lualine_theme, - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - }, - extensions = { "fzf", "nvim-tree" }, - }) - end, - }) - - -- https://github.com/kyazdani42/nvim-tree.lua - use({ - "kyazdani42/nvim-tree.lua", - config = function() - require("nvim-tree").setup({ - renderer = { - icons = { - show = { - file = false, - folder = false, - folder_arrow = false, - git = false, - }, + -- https://github.com/kyazdani42/nvim-tree.lua + use({ + "kyazdani42/nvim-tree.lua", + config = function() + require("nvim-tree").setup({ + renderer = { + icons = { + show = { + file = false, + folder = false, + folder_arrow = false, + git = false, }, }, - git = { - enable = true, - ignore = true, - }, - filters = { - custom = { "^\\.git$" }, - }, - }) - end, - }) + }, + git = { + enable = true, + ignore = true, + }, + filters = { + custom = { "^\\.git$" }, + }, + }) + end, + }) - -- https://github.com/lukas-reineke/indent-blankline.nvim - use({ - "lukas-reineke/indent-blankline.nvim", - config = function() - require("indent_blankline").setup() - end, - }) + -- https://github.com/lukas-reineke/indent-blankline.nvim + use({ + "lukas-reineke/indent-blankline.nvim", + config = function() + require("indent_blankline").setup() + end, + }) - -- https://github.com/junegunn/fzf.vim - use("junegunn/fzf.vim") + -- https://github.com/junegunn/fzf.vim + use("junegunn/fzf.vim") - -- https://github.com/Pocco81/true-zen.nvim - use({ - "Pocco81/true-zen.nvim", - config = function() - require("true-zen").setup() - end, - }) + -- Colorschemes + -- https://github.com/cocopon/iceberg.vim + use("cocopon/iceberg.vim") - -- Colorschemes - -- https://github.com/cocopon/iceberg.vim - use("cocopon/iceberg.vim") + -- Programming languages + -- https://github.com/sbdchd/neoformat + use("sbdchd/neoformat") - -- https://github.com/junegunn/seoul256.vim - use("junegunn/seoul256.vim") + -- https://github.com/fatih/vim-go + use("fatih/vim-go") - -- https://github.com/catppuccin/nvim - use({ - "catppuccin/nvim", - as = "catppuccin", - config = function() - local catppuccin_term_colors = false - if vim.opt.termguicolors then - catppuccin_term_colors = true - end + -- https://github.com/github/copilot.vim + use("github/copilot.vim") +end) - require("catppuccin").setup({ - term_colors = catppuccin_term_colors, - }) - end, - }) - - -- Programming languages - -- https://github.com/sbdchd/neoformat - use("sbdchd/neoformat") - - -- https://github.com/fatih/vim-go - use("fatih/vim-go") - - -- https://github.com/github/copilot.vim - use("github/copilot.vim") - end) - - if vim.opt.termguicolors then - vim.cmd([[ colorscheme catppuccin ]]) - else - vim.cmd([[ colorscheme iceberg ]]) - end -end +vim.cmd([[ colorscheme iceberg ]])