diff --git a/Makefile b/Makefile index 9599bec..c9eff71 100644 --- a/Makefile +++ b/Makefile @@ -296,8 +296,10 @@ install_asdf: check_os .PHONY: install_vim install_vim: check_os link_vim - @echo "Installing vim packages..." - @echo "y\n\n\n" | nvim +PackerCompile +PackerInstall +qall + @echo "Vim package installation is no longer done automatically!" + @echo "Start Vim or NeoVim and run:" + @echo "For NeoVim: :PackerInstall" + @echo "For Vim: :PlugInstall" .PHONY: oh_my_zsh oh_my_zsh: check_os diff --git a/symlinks/config/nvim/init.lua b/symlinks/config/nvim/init.lua index 880c33e..3a2132f 100644 --- a/symlinks/config/nvim/init.lua +++ b/symlinks/config/nvim/init.lua @@ -1,4 +1,4 @@ -if require('personal.first_load')() then +if require('init.first_load')() then return end @@ -13,17 +13,17 @@ vim.g.mapleader = ' ' -- Globals taken from TJ config -- Helpful for configuration -- Might be removed in future version of NeoVim -require('personal.globals') +require('init.globals') -require('personal.plugins') +require('init.plugins') -require('personal.options') +require('init.options') require('lsp') -- Colorscheme vim.cmd('syntax on') -require('personal.colors') +require('init.colors') vim.api.nvim_set_keymap('n', 'Q', 'gq', {}) vim.api.nvim_set_keymap('i', '', 'u', {noremap = true}) diff --git a/symlinks/config/nvim/lua/init/colors.lua b/symlinks/config/nvim/lua/init/colors.lua new file mode 100644 index 0000000..8fbb162 --- /dev/null +++ b/symlinks/config/nvim/lua/init/colors.lua @@ -0,0 +1,3 @@ +-- vim.o.termguicolors = true -- Does not look good with gruvbox +vim.o.background = "dark" +vim.cmd([[colorscheme gruvbox]]) diff --git a/symlinks/config/nvim/lua/personal/first_load.lua b/symlinks/config/nvim/lua/init/first_load.lua similarity index 100% rename from symlinks/config/nvim/lua/personal/first_load.lua rename to symlinks/config/nvim/lua/init/first_load.lua diff --git a/symlinks/config/nvim/lua/personal/globals/init.lua b/symlinks/config/nvim/lua/init/globals/init.lua similarity index 94% rename from symlinks/config/nvim/lua/personal/globals/init.lua rename to symlinks/config/nvim/lua/init/globals/init.lua index 1f1b956..685a0c4 100644 --- a/symlinks/config/nvim/lua/personal/globals/init.lua +++ b/symlinks/config/nvim/lua/init/globals/init.lua @@ -16,4 +16,4 @@ if pcall(require, 'plenary') then end -- `vim.opt` -require('personal.globals.opt') +require('init.globals.opt') diff --git a/symlinks/config/nvim/lua/personal/globals/opt.lua b/symlinks/config/nvim/lua/init/globals/opt.lua similarity index 100% rename from symlinks/config/nvim/lua/personal/globals/opt.lua rename to symlinks/config/nvim/lua/init/globals/opt.lua diff --git a/symlinks/config/nvim/lua/personal/options.lua b/symlinks/config/nvim/lua/init/options.lua similarity index 100% rename from symlinks/config/nvim/lua/personal/options.lua rename to symlinks/config/nvim/lua/init/options.lua diff --git a/symlinks/config/nvim/lua/personal/plugins.lua b/symlinks/config/nvim/lua/init/plugins.lua similarity index 94% rename from symlinks/config/nvim/lua/personal/plugins.lua rename to symlinks/config/nvim/lua/init/plugins.lua index 0039a79..1215302 100644 --- a/symlinks/config/nvim/lua/personal/plugins.lua +++ b/symlinks/config/nvim/lua/init/plugins.lua @@ -20,7 +20,7 @@ return require('packer').startup { use 'mhinz/vim-grepper' use 'direnv/direnv.vim' use 'tpope/vim-speeddating' - use 'sainnhe/gruvbox-material' + use 'flazz/vim-colorschemes' -- Tools use 'tpope/vim-dispatch' @@ -55,6 +55,7 @@ return require('packer').startup { -- Treesitter use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + -- use { 'npxbr/gruvbox.nvim', requires = { 'rktjmp/lush.nvim' } } -- LSP -- use 'tjdevries/nlua.nvim' diff --git a/symlinks/config/nvim/lua/lsp/completion.lua b/symlinks/config/nvim/lua/lsp/completion.lua index 784391f..a9de9bd 100644 --- a/symlinks/config/nvim/lua/lsp/completion.lua +++ b/symlinks/config/nvim/lua/lsp/completion.lua @@ -7,6 +7,7 @@ vim.o.completeopt = "menuone,noinsert,noselect" -- Avoid showing message extra message when using completion vim.cmd('set shortmess+=c') -vim.cmd('let g:completion_enable_snippet = "UltiSnips"') -vim.cmd('let g:completion_confirm_key = "\\"') vim.cmd("autocmd BufEnter * lua require'completion'.on_attach()") +vim.g.completion_matching_strategy_list = {'exact', 'substring', 'fuzzy'} +vim.g.completion_confirm_key = '' +vim.g.completion_enable_snippet = 'UltiSnips' diff --git a/symlinks/config/nvim/lua/lsp/init.lua b/symlinks/config/nvim/lua/lsp/init.lua index a2a838c..8d331e3 100644 --- a/symlinks/config/nvim/lua/lsp/init.lua +++ b/symlinks/config/nvim/lua/lsp/init.lua @@ -5,4 +5,3 @@ require("lsp.diagnostic") require("lsp.servers") require("lsp.completion") -require("lsp.maps") diff --git a/symlinks/config/nvim/lua/lsp/maps.lua b/symlinks/config/nvim/lua/lsp/maps.lua deleted file mode 100644 index 983bbe6..0000000 --- a/symlinks/config/nvim/lua/lsp/maps.lua +++ /dev/null @@ -1,20 +0,0 @@ -------------------------------------------------------------------------------- --- - LSP related keymaps - -------------------------------------------------------------------------------- -default_opts = {noremap = true, silent = true} - --- Lsp keymaps -vim.api.nvim_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', default_opts) -vim.api.nvim_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', default_opts) -vim.api.nvim_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', default_opts) -vim.api.nvim_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', default_opts) -vim.api.nvim_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', default_opts) -vim.api.nvim_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', default_opts) -vim.api.nvim_set_keymap('n', '', 'lua vim.lsp.buf.code_action()', default_opts) -vim.api.nvim_set_keymap('n', 'ac', 'lua vim.lsp.buf.code_action()', default_opts) -vim.api.nvim_set_keymap('n', 'a', 'lua vim.lsp.buf.code_action_range()', default_opts) - -completion_opts = {silent = true} - --- Completion keymaps -vim.api.nvim_set_keymap('i', '', '(completion_trigger)', completion_opts) diff --git a/symlinks/config/nvim/lua/lsp/servers.lua b/symlinks/config/nvim/lua/lsp/servers.lua index 5bec69e..ae79091 100644 --- a/symlinks/config/nvim/lua/lsp/servers.lua +++ b/symlinks/config/nvim/lua/lsp/servers.lua @@ -6,15 +6,36 @@ local lspconfig = require("lspconfig") local on_attach = function(client, bufnr) require'completion'.on_attach() + + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + + default_opts = {noremap = true, silent = true} + + -- Lsp keymaps + buf_set_keymap('n', '', 'lua vim.lsp.buf.definition()', default_opts) + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', default_opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', default_opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', default_opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', default_opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', default_opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.code_action()', default_opts) + buf_set_keymap('n', 'ac', 'lua vim.lsp.buf.code_action()', default_opts) + buf_set_keymap('n', 'a', 'lua vim.lsp.buf.code_action_range()', default_opts) + + completion_opts = {silent = true} + + -- Completion keymaps + buf_set_keymap('i', '', '(completion_trigger)', completion_opts) +end + +-- Lsp default language servers +local servers = { "bashls", "clangd", "dartls", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls" } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { on_attach = on_attach } end --- Lsp language servers -lspconfig.bashls.setup {on_attach = on_attach} -lspconfig.clangd.setup {on_attach = on_attach} -lspconfig.dartls.setup {on_attach = on_attach} -lspconfig.jsonls.setup {on_attach = on_attach} -lspconfig.pyright.setup {on_attach = on_attach} -lspconfig.rust_analyzer.setup {on_attach = on_attach} -lspconfig.vimls.setup {on_attach = on_attach} -- Lua bultin lsp -- require('nlua.lsp.nvim').setup(lspconfig, { diff --git a/symlinks/config/nvim/lua/personal/colors.lua b/symlinks/config/nvim/lua/personal/colors.lua deleted file mode 100644 index 20220ae..0000000 --- a/symlinks/config/nvim/lua/personal/colors.lua +++ /dev/null @@ -1 +0,0 @@ -vim.api.nvim_exec('colorscheme gruvbox-material', false) diff --git a/symlinks/config/nvim/plugin/coc.vim b/symlinks/config/nvim/plugin/coc.vim deleted file mode 100644 index 7a4c9ac..0000000 --- a/symlinks/config/nvim/plugin/coc.vim +++ /dev/null @@ -1,79 +0,0 @@ -" Must have extensions! - -lua <", "lua vim.lsp.buf.definition()", default_opts) -vim.api.nvim_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", default_opts) -vim.api.nvim_set_keymap("n", "gr", "lua vim.lsp.buf.references()", default_opts) -vim.api.nvim_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", default_opts) -vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", default_opts) -vim.api.nvim_set_keymap("n", "K", "lua vim.lsp.buf.hover()", default_opts) -vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.code_action()", default_opts) -vim.api.nvim_set_keymap("n", "ac", "lua vim.lsp.buf.code_action()", default_opts) -vim.api.nvim_set_keymap("n", "a", "lua vim.lsp.buf.code_action_range()", default_opts) - -lspconfig.bashls.setup {on_attach = on_attach} -lspconfig.clangd.setup {on_attach = on_attach} -lspconfig.dartls.setup {on_attach = on_attach} -lspconfig.jsonls.setup {on_attach = on_attach} -lspconfig.pyright.setup {on_attach = on_attach} -lspconfig.rust_analyzer.setup {on_attach = on_attach} -lspconfig.vimls.setup {on_attach = on_attach} - -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - incomplete_delay = 400; - max_abbr_width = 100; - max_kind_width = 100; - max_menu_width = 100; - documentation = true; - - source = { - path = true; - buffer = true; - calc = true; - vsnip = true; - nvim_lsp = true; - nvim_lua = true; - spell = true; - tags = true; - snippets_nvim = true; - treesitter = true; - }; -} - -require("nvim-ale-diagnostic") - -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - underline = false, - virtual_text = false, - signs = true, - update_in_insert = false, - } -) - -EOF - -inoremap compe#complete() -inoremap compe#confirm('') -inoremap compe#close('') -inoremap compe#scroll({ 'delta': +4 }) -inoremap compe#scroll({ 'delta': -4 }) - -" Set completeopt to have a better completion experience -set completeopt=menuone,noselect diff --git a/symlinks/config/nvim/plugin/statusline.vim b/symlinks/config/nvim/plugin/statusline.vim index f3f5406..325235d 100644 --- a/symlinks/config/nvim/plugin/statusline.vim +++ b/symlinks/config/nvim/plugin/statusline.vim @@ -3,8 +3,8 @@ " ----------------------------------------------------------------------------- function s:UpdateColors() - let ctermbg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'cterm') - let guibg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'gui') + let ctermbg = synIDattr(synIDtrans(hlID('StatusLine')), 'fg', 'cterm') + let guibg = synIDattr(synIDtrans(hlID('StatusLine')), 'fg', 'gui') let idguifg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'gui') let idctermfg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'cterm') " Green in gruvbox @@ -14,8 +14,8 @@ function s:UpdateColors() if l:idctermfg1 exec 'hi User1 ctermfg=' . l:idctermfg1 endif - let idguifg2 = synIDattr(synIDtrans(hlID('ErrorMsg')), 'fg', 'gui') - let idctermfg2 = synIDattr(synIDtrans(hlID('ErrorMsg')), 'fg', 'cterm') + let idguifg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'gui') + let idctermfg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'cterm') " Red in gruvbox exec 'hi User2 guifg=' . l:idguifg2 . \' guibg=' . l:guibg . @@ -23,8 +23,8 @@ function s:UpdateColors() if l:idctermfg2 exec 'hi User2 ctermfg=' . l:idctermfg2 endif - let idguifg3 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'gui') - let idctermfg3 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'cterm') + let idguifg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'gui') + let idctermfg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'cterm') " Yellow in gruvbox exec 'hi User3 guifg=' . l:idguifg3 . \' guibg=' . l:guibg . diff --git a/symlinks/config/nvim/spell/en.utf-8.add b/symlinks/config/nvim/spell/en.utf-8.add deleted file mode 100644 index 8ed1446..0000000 --- a/symlinks/config/nvim/spell/en.utf-8.add +++ /dev/null @@ -1 +0,0 @@ -Polymorphism diff --git a/symlinks/config/nvim/spell/en.utf-8.add.spl b/symlinks/config/nvim/spell/en.utf-8.add.spl deleted file mode 100644 index 735e29c..0000000 Binary files a/symlinks/config/nvim/spell/en.utf-8.add.spl and /dev/null differ diff --git a/symlinks/config/nvim/spell/en.utf-8.spl b/symlinks/config/nvim/spell/en.utf-8.spl deleted file mode 100644 index 83b9b8f..0000000 Binary files a/symlinks/config/nvim/spell/en.utf-8.spl and /dev/null differ diff --git a/symlinks/config/nvim/spell/en.utf-8.sug b/symlinks/config/nvim/spell/en.utf-8.sug deleted file mode 100644 index bbdf36a..0000000 Binary files a/symlinks/config/nvim/spell/en.utf-8.sug and /dev/null differ