diff --git a/programs/fish/default.nix b/programs/fish/default.nix index 312537e..37c75e9 100644 --- a/programs/fish/default.nix +++ b/programs/fish/default.nix @@ -54,7 +54,7 @@ set -xg TOOLCHAINS swift - set -xg DEVELOPER_DIR "/Library/Developer/CommandLineTools" + # set -xg DEVELOPER_DIR "/Library/Developer/CommandLineTools" set -xg OPENAI_API_KEY (cat ~/.openai) set -xg ANTHROPIC_API_KEY (cat ~/.anthropic) ''; diff --git a/programs/nixvim/_plugins/default.nix b/programs/nixvim/_plugins/default.nix index c384695..b89a7cb 100644 --- a/programs/nixvim/_plugins/default.nix +++ b/programs/nixvim/_plugins/default.nix @@ -99,6 +99,7 @@ }; trouble.enable = true; + typst-preview.enable = true; which-key.enable = true; }; }; diff --git a/programs/nixvim/_plugins/lsp.nix b/programs/nixvim/_plugins/lsp.nix index ed030e5..4558e29 100644 --- a/programs/nixvim/_plugins/lsp.nix +++ b/programs/nixvim/_plugins/lsp.nix @@ -7,6 +7,29 @@ lsp = { inlayHints.enable = true; servers = { + basedpyright = { + enable = true; + settings.settings.basedpyright = { + analysis = { + autoImportCompletions = true; + autoSearchPaths = true; + inlayHints = { + callArgumentNames = true; + }; + diagnosticMode = "openFilesOnly"; + reportMissingImports = true; + reportMissingParameterType = true; + reportUnnecessaryComparison = true; + reportUnnecessaryContains = true; + reportUnusedClass = true; + reportUnusedFunction = true; + reportUnsedImports = true; + reportUnsusedVariables = true; + typeCheckingMode = "recommended"; + useLibraryCodeForTypes = true; + }; + }; + }; bashls.enable = true; html.enable = true; jqls.enable = true; @@ -19,33 +42,55 @@ metals.enable = true; nil_ls.enable = true; nixd.enable = true; - pyrefly.enable = true; rust_analyzer.enable = true; - sourcekit.enable = true; + sourcekit = { + enable = true; + settings = { + cmd = [ + "xcrun" + "sourcekit-lsp" + ]; + }; + }; + tinymist.enable = true; ts_ls.enable = true; yamlls.enable = true; }; - keymaps = - lib.mapAttrsToList - ( - key: props: - { - inherit key; - options.silent = true; - } - // props - ) - { - "k".action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end"; - "j".action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end"; - gd.lspBufAction = "definition"; - gD.lspBufAction = "references"; - gt.lspBufAction = "type_definition"; - gi.lspBufAction = "implementation"; - K.lspBufAction = "hover"; - "".lspBufAction = "rename"; - }; + keymaps = [ + { + key = "k"; + action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end"; + } + { + key = "j"; + action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end"; + } + { + key = "gd"; + lspBufAction = "definition"; + } + { + key = "gD"; + lspBufAction = "references"; + } + { + key = "gt"; + lspBufAction = "type_definition"; + } + { + key = "gi"; + lspBufAction = "implementation"; + } + { + key = "K"; + lspBufAction = "hover"; + } + { + key = ""; + lspBufAction = "rename"; + } + ]; }; plugins = { diff --git a/programs/nixvim/autocommands.nix b/programs/nixvim/autocommands.nix new file mode 100644 index 0000000..71cf023 --- /dev/null +++ b/programs/nixvim/autocommands.nix @@ -0,0 +1,34 @@ +{ ... }: + +{ + programs.nixvim.autoCmd = [ + # Vertically center document when entering insert mode + { + event = "InsertEnter"; + command = "norm zz"; + } + + # Open help in a vertical split + { + event = "FileType"; + pattern = "help"; + command = "wincmd L"; + } + + # Enable spellcheck for some filetypes + { + event = "FileType"; + pattern = [ + "markdown" + ]; + command = "setlocal spell spelllang=en"; + } + + # Set indentation for specific filetypes + { + event = "FileType"; + pattern = ["swift" "json" "lua" "nix"]; + command = "setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab"; + } + ]; +} diff --git a/programs/nixvim/completion.nix b/programs/nixvim/completion.nix index 18b1ce3..27e88a6 100644 --- a/programs/nixvim/completion.nix +++ b/programs/nixvim/completion.nix @@ -11,6 +11,17 @@ plugins = { luasnip.enable = true; + cmp-buffer.enable = true; + cmp-cmdline.enable = true; + cmp-fish.enable = true; + cmp-git.enable = true; + cmp_luasnip.enable = true; + cmp-nvim-lsp.enable = true; + cmp-nvim-lsp-document-symbol.enable = true; + cmp-nvim-lsp-signature-help.enable = true; + cmp-nvim-lua.enable = true; + cmp-path.enable = true; + lspkind = { enable = true; @@ -19,11 +30,10 @@ enable = true; menu = { nvim_lsp = "[LSP]"; - nvim_lua = "[api]"; - path = "[path]"; luasnip = "[snip]"; buffer = "[buffer]"; - cmp_tabby = "[Tabby]"; + path = "[path]"; + nvim_lua = "[api]"; }; }; }; @@ -31,8 +41,14 @@ cmp = { enable = true; - + autoEnableSources = true; settings = { + performance = { + debounce = 60; + throttle = 30; + fetching_timeout = 200; + }; + snippet.expand = '' function(args) require('luasnip').lsp_expand(args.body) @@ -50,13 +66,15 @@ }; sources = [ - { name = "path"; } { name = "nvim_lsp"; } { name = "luasnip"; } { name = "buffer"; option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; } + { name = "path"; } + { name = "nvim_lua"; } + { name = "cmp-nvim-lsp-signature-help"; } ]; }; }; diff --git a/programs/nixvim/default.nix b/programs/nixvim/default.nix index 8ad3bef..7143ccf 100644 --- a/programs/nixvim/default.nix +++ b/programs/nixvim/default.nix @@ -2,9 +2,10 @@ { imports = [ - ./options.nix - ./keymappings.nix + ./autocommands.nix ./completion.nix + ./keymappings.nix + ./options.nix ./_plugins ]; diff --git a/programs/nixvim/options.nix b/programs/nixvim/options.nix index 1d1e3b1..99284df 100644 --- a/programs/nixvim/options.nix +++ b/programs/nixvim/options.nix @@ -24,7 +24,7 @@ tabstop = 2; termguicolors = true; undofile = true; - updatetime = 250; + updatetime = 100; wrap = false; };