diff --git a/nix/home/programs/git/default.nix b/nix/home/programs/git/default.nix index 0fecc84..f69e983 100644 --- a/nix/home/programs/git/default.nix +++ b/nix/home/programs/git/default.nix @@ -3,23 +3,18 @@ let in { - programs.delta = { - enable = true; - options = { - side-by-side = true; - line-numbers = true; - }; - enableGitIntegration = true; - }; - programs.git = { enable = true; - settings = { - user = { - name = "Haak Saxberg"; - email = "haak.erling@gmail.com"; + userName = "Haak Saxberg"; + userEmail = "haak.erling@gmail.com"; + delta = { + enable = true; + options = { + side-by-side = true; + line-numbers = true; }; - + }; + extraConfig = { rebase = { updateRefs = true; }; diff --git a/nix/home/programs/nvim/default.nix b/nix/home/programs/nvim/default.nix index 45ddce7..60cd79d 100644 --- a/nix/home/programs/nvim/default.nix +++ b/nix/home/programs/nvim/default.nix @@ -28,33 +28,26 @@ with builtins; vimAlias = true; plugins = with pkgs.vimPlugins; [ vim-sensible - { - plugin = vim-precognition; - config = '' - 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 - ''; - } - - # cosmetic improvements + vim-startify catppuccin-nvim - vim-illuminate # highlight cursor-word - nvim-web-devicons + vim-precognition + nvim-treesitter.withAllGrammars + + { + plugin = fzf-vim; + config = '' + noremap fc :BCommits + ''; + } + vim-elixir + alchemist-vim + vim-nix + vim-javascript + vim-json + vim-jsx-pretty + + vim-commentary + vim-airline { plugin = rainbow; config = '' @@ -73,58 +66,37 @@ 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 { - # file explorer - plugin = oil-nvim; + plugin = vim-fugitive; config = '' - lua << EOF - require("oil").setup() - vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) - EOF + 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 ''; } { @@ -146,42 +118,6 @@ 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; @@ -193,20 +129,22 @@ with builtins; # we'll probably always want them around. lua_ls = pkgs.lua-language-server; nixd = pkgs.nixd; - - # Nearly always want the diagnostic server + ts_server = pkgs.nodePackages.typescript-language-server; diagnostic_server = pkgs.nodePackages.diagnostic-languageserver; } ) } EOF ''; } - - # language-specific plugins - vim-nix - vim-json - dart-vim-plugin - + { + 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() + ''; + } # 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 72af96d..a3c9351 100644 --- a/nix/home/programs/nvim/init.vim +++ b/nix/home/programs/nvim/init.vim @@ -51,6 +51,7 @@ 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 @@ -84,3 +85,11 @@ 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 72b8188..9862892 100644 --- a/nix/home/programs/nvim/nvim-lspconfig.lua +++ b/nix/home/programs/nvim/nvim-lspconfig.lua @@ -1,6 +1,12 @@ -vim.lsp.config('*', { - capabilities = require("cmp_nvim_lsp").default_capabilities() -}) +local nvim_lsp = require("lspconfig") +-- +-- https://vonheikemen.github.io/devlog/tools/setup-nvim-lspconfig-plus-nvim-cmp/ +local lsp_defaults = nvim_lsp.util.default_config +lsp_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require("cmp_nvim_lsp").default_capabilities() +) vim.api.nvim_create_autocmd("LspAttach", { desc = "LSP actions", @@ -55,7 +61,7 @@ vim.api.nvim_create_autocmd("BufWritePre", { end }) -vim.lsp.config("diagnosticls", { +nvim_lsp.diagnosticls.setup { cmd = { "@diagnostic_server@/bin/diagnostic-languageserver", '--stdio' }, filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'css', 'scss', 'markdown', 'pandoc', 'prisma' }, @@ -134,37 +140,34 @@ vim.lsp.config("diagnosticls", { prisma = 'prettier' } } -}); -vim.lsp.enable("diagnosticls"); +} -vim.lsp.config("elmls", {}) +nvim_lsp.elmls.setup { +} local capabilitiesWithoutFomatting = vim.lsp.protocol.make_client_capabilities() capabilitiesWithoutFomatting.textDocument.formatting = false capabilitiesWithoutFomatting.textDocument.rangeFormatting = false capabilitiesWithoutFomatting.textDocument.range_formatting = false -vim.lsp.config("ts_ls", { - cmd = { "typescript-language-server", '--stdio' }, +nvim_lsp.ts_ls.setup { + cmd = { "@ts_server@/bin/typescript-language-server", '--stdio' }, init_options = { hostInfo = "neovim", maxTsServerMemory = "8192", preferences = { quotePreference = "single", allowIncompleteCompletions = false }, capabilities = capabilitiesWithoutFomatting } -}) -vim.lsp.config("elixirls", { +} +nvim_lsp.elixirls.setup { cmd = { "elixir-ls" }, -}) - -vim.lsp.config("nixd", { +} +nvim_lsp.nixd.setup { cmd = { "@nixd@/bin/nixd" }, -}); -vim.lsp.enable("nixd"); +} +nvim_lsp.rust_analyzer.setup {} -vim.lsp.config("rust_analyzer", {}) - -vim.lsp.config("lua_ls", { +nvim_lsp.lua_ls.setup { cmd = { "@lua_ls@/bin/lua-language-server" }, single_file_support = true, flags = { @@ -177,10 +180,8 @@ vim.lsp.config("lua_ls", { } } }, -}) +} -vim.lsp.config("texlab", {}) +nvim_lsp.texlab.setup {} -vim.lsp.config("gleam", {}) - -vim.lsp.config("dartls", {}) +nvim_lsp.gleam.setup {} diff --git a/nix/home/programs/yazi/default.nix b/nix/home/programs/yazi/default.nix index cc71449..dd26a32 100644 --- a/nix/home/programs/yazi/default.nix +++ b/nix/home/programs/yazi/default.nix @@ -1,9 +1,7 @@ { pkgs, ... }: { - # A command-line file manager programs.yazi = { enable = true; enableZshIntegration = true; - shellWrapperName = "y"; }; } diff --git a/nix/home/programs/zsh/default.nix b/nix/home/programs/zsh/default.nix index 17bdc7e..53c4ad1 100644 --- a/nix/home/programs/zsh/default.nix +++ b/nix/home/programs/zsh/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: with builtins; { @@ -22,8 +22,6 @@ with builtins; { "vi-mode" ]; }; - - dotDir = "${config.xdg.configHome}/zsh"; }; home.file.".oh-my-zsh/custom/themes/typewritten.zsh-theme" = { diff --git a/nix/home/universal.nix b/nix/home/universal.nix index a58d0ac..6485149 100644 --- a/nix/home/universal.nix +++ b/nix/home/universal.nix @@ -45,8 +45,8 @@ with builtins; (import ./programs/zsh) (import ./programs/tmux) (import ./programs/nvim) - # (import ./programs/helix) - # (import ./programs/yazi) + (import ./programs/helix) + (import ./programs/yazi) ]; home.packages = defaultPkgs;