diff --git a/nix/home/programs/nvim/default.nix b/nix/home/programs/nvim/default.nix index 60cd79d..0cfdff5 100644 --- a/nix/home/programs/nvim/default.nix +++ b/nix/home/programs/nvim/default.nix @@ -28,26 +28,32 @@ with builtins; vimAlias = true; plugins = with pkgs.vimPlugins; [ vim-sensible - vim-startify - catppuccin-nvim - vim-precognition - nvim-treesitter.withAllGrammars - { - plugin = fzf-vim; + plugin = vim-precognition; config = '' - noremap fc :BCommits + lua << EOF + require("precognition").setup({}) + EOF + noremap ? :lua require("precognition").peek() + ''; + } + plenary-nvim + { + plugin = nvim-treesitter-legacy.withAllGrammars; + config = '' + lua << EOF + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + }, + } + EOF ''; } - vim-elixir - alchemist-vim - vim-nix - vim-javascript - vim-json - vim-jsx-pretty - vim-commentary - vim-airline + # cosmetic improvements + catppuccin-nvim + vim-illuminate { plugin = rainbow; config = '' @@ -66,37 +72,58 @@ with builtins; let g:indent_guides_start_level = 2 ''; } + + # language-agnostic editor improvements + { + plugin = fzf-vim; + config = '' + noremap fc :BCommits + ''; + } + which-key-nvim + { + plugin = alpha-nvim; + config = '' + lua << EOF + local alpha = require("alpha"); + local dashboard = require("alpha.themes.startify"); + alpha.setup(dashboard.config); + EOF + ''; + } + { + plugin = nvim-autopairs; + config = '' + lua << EOF + require("nvim-autopairs").setup {} + EOF + ''; + } + { + plugin = lualine-nvim; + config = '' + lua << EOF + require('lualine').setup() + EOF + ''; + } + { + plugin = comment-nvim; + config = '' + lua << EOF + require('Comment').setup() + EOF + ''; + } vim-surround { - plugin = vim-fugitive; + # file explorer + plugin = oil-nvim; config = '' - nnoremap gb :Git blame - ''; - } - { - plugin = git-blame-nvim; - config = '' - let g:gitblame_date_format = '%Y-%m-%d' - nnoremap gC :GitBlameOpenCommitURL - ''; - } - { - plugin = neogit; - config = '' - noremap g :Neogit - lua << EOF - local neogit = require('neogit') - neogit.setup {} - EOF - ''; - } - vinegar - { - plugin = gitsigns-nvim; - config = '' - lua << EOF - require('gitsigns').setup() - EOF + lua << EOF + require("oil").setup() + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + EOF ''; } { @@ -118,6 +145,42 @@ with builtins; endif ''; } + { + plugin = telescope-nvim; + config = '' + nnoremap ff lua require('telescope.builtin').find_files() + nnoremap fg lua require('telescope.builtin').live_grep() + nnoremap fb lua require('telescope.builtin').buffers() + nnoremap fh lua require('telescope.builtin').help_tags() + ''; + } + nvim-dap + nvim-dap-ui + + # Git stuff + { + plugin = vim-fugitive; + config = '' + nnoremap gb :Git blame + ''; + } + { + plugin = git-blame-nvim; + config = '' + let g:gitblame_date_format = '%Y-%m-%d' + nnoremap gC :GitBlameOpenCommitURL + ''; + } + { + plugin = gitsigns-nvim; + config = '' + lua << EOF + require('gitsigns').setup() + EOF + ''; + } + + # Language servers cmp-nvim-lsp { plugin = nvim-lspconfig; @@ -129,22 +192,20 @@ with builtins; # we'll probably always want them around. lua_ls = pkgs.lua-language-server; nixd = pkgs.nixd; - ts_server = pkgs.nodePackages.typescript-language-server; + + # Nearly always want the diagnostic server diagnostic_server = pkgs.nodePackages.diagnostic-languageserver; } ) } EOF ''; } - { - plugin = telescope-nvim; - config = '' - nnoremap ff lua require('telescope.builtin').find_files() - nnoremap fg lua require('telescope.builtin').live_grep() - nnoremap fb lua require('telescope.builtin').buffers() - nnoremap fh lua require('telescope.builtin').help_tags() - ''; - } + + # language-specific plugins + vim-nix + vim-json + dart-vim-plugin + # have the completion plugin get loaded last just in case anything above # needs to do setup work before completions get set up. { diff --git a/nix/home/programs/nvim/init.vim b/nix/home/programs/nvim/init.vim index a3c9351..72af96d 100644 --- a/nix/home/programs/nvim/init.vim +++ b/nix/home/programs/nvim/init.vim @@ -51,7 +51,6 @@ autocmd BufWritePre * :%s/\s\+$//e noremap ; : inoremap jj noremap Q -noremap ? :lua require("precognition").peek() """ Esperanto digraphs (for use with ctrl-k) :digraph Cx 264 @@ -85,11 +84,3 @@ set scrolloff=10 if filereadable($HOME . "/.vimrc.local") source ~/.vimrc.local endif - -lua << EOF -require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - }, - } -EOF diff --git a/nix/home/programs/nvim/nvim-lspconfig.lua b/nix/home/programs/nvim/nvim-lspconfig.lua index 9862892..b15eaca 100644 --- a/nix/home/programs/nvim/nvim-lspconfig.lua +++ b/nix/home/programs/nvim/nvim-lspconfig.lua @@ -151,7 +151,7 @@ capabilitiesWithoutFomatting.textDocument.rangeFormatting = false capabilitiesWithoutFomatting.textDocument.range_formatting = false nvim_lsp.ts_ls.setup { - cmd = { "@ts_server@/bin/typescript-language-server", '--stdio' }, + cmd = { "typescript-language-server", '--stdio' }, init_options = { hostInfo = "neovim", maxTsServerMemory = "8192", @@ -185,3 +185,5 @@ nvim_lsp.lua_ls.setup { nvim_lsp.texlab.setup {} nvim_lsp.gleam.setup {} + +nvim_lsp.dartls.setup {}