diff --git a/home/nvim/default.nix b/home/nvim/default.nix index 7fcad69..bc43bef 100644 --- a/home/nvim/default.nix +++ b/home/nvim/default.nix @@ -18,20 +18,14 @@ extraConfig = builtins.readFile ./config.vim; plugins = with pkgs.vimPlugins; - [ - cmp-nvim-lsp - cmp-buffer - cmp-emoji - cmp-path - cmp-cmdline - cmp-nvim-ultisnips - nvim-cmp - { - plugin = nvim-lspconfig; - type = "lua"; - config = builtins.readFile ./lsp.lua; - } + [ + cmp-buffer + cmp-cmdline + cmp-emoji + cmp-nvim-lsp + cmp-nvim-ultisnips + cmp-path { plugin = fzf-vim; @@ -71,10 +65,34 @@ nnoremap ]of :Limelight! ''; } + + nabla-nvim + neogit + + { + plugin = nvim-cmp; + type = "lua"; + config = builtins.readFile ./nvim-cmp.lua; + } + { plugin = nvim-colorizer-lua; config = "lua require 'colorizer'.setup()"; } + + { + plugin = nvim-lspconfig; + type = "lua"; + config = '' + vim.lsp.enable('astro') + vim.lsp.enable('marksman') + vim.lsp.enable('nil_ls') + vim.lsp.enable('r_language_server') + vim.lsp.enable('texlab') + vim.lsp.enable('ts_ls') + ''; + } + { plugin = papercolor-theme; config = '' @@ -82,7 +100,9 @@ colorscheme PaperColor ''; } + typescript-vim + { plugin = ultisnips; type = "lua"; @@ -90,14 +110,18 @@ vim.api.nvim_set_keymap('n', 'se', ':UltiSnipsEdit!', { noremap = true, silent = true }) ''; } + vifm-vim + { plugin = vim-astro; config = '' let g:astro_typescript = 'enable' ''; } + vim-commentary + { plugin = vim-easy-align; config = '' @@ -105,9 +129,11 @@ nmap ga (EasyAlign) ''; } + vim-fish vim-nix vim-repeat + { plugin = vim-slime; config = '' @@ -121,10 +147,12 @@ nnoremap s: :SlimeSend1 ''; } + vim-snippets vim-speeddating vim-surround vim-unimpaired + vimwiki ]; }; diff --git a/home/nvim/nvim-cmp.lua b/home/nvim/nvim-cmp.lua new file mode 100644 index 0000000..9beae67 --- /dev/null +++ b/home/nvim/nvim-cmp.lua @@ -0,0 +1,72 @@ +local cmp = require'cmp' + +cmp.setup({ + + snippet = { + expand = function(args) + vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + + sources = cmp.config.sources({ + { name = 'cmp_pandoc' }, + { name = 'emoji' }, + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'ultisnips' }, + }, { + { name = 'buffer' }, + }) + +}) + +-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below +-- Set configuration for specific filetype. +--[[ cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, + }, { + { name = 'buffer' }, + }) +}) +require("cmp_git").setup() ]]-- + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), + matching = { disallow_symbol_nonprefix_matching = false } +}) + +-- Set up lspconfig. +local capabilities = require('cmp_nvim_lsp').default_capabilities() +-- Replace with each lsp server you've enabled. +vim.lsp.config('', { + capabilities = capabilities +}) +vim.lsp.enable('')