corrections and improvements to have all neovim lsp and completions working

This commit is contained in:
Salar Rahmanian 2025-10-05 00:36:55 -07:00
parent f98fe01b0c
commit 7584b9ebfc
7 changed files with 130 additions and 31 deletions

View file

@ -54,7 +54,7 @@
set -xg TOOLCHAINS swift 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 OPENAI_API_KEY (cat ~/.openai)
set -xg ANTHROPIC_API_KEY (cat ~/.anthropic) set -xg ANTHROPIC_API_KEY (cat ~/.anthropic)
''; '';

View file

@ -99,6 +99,7 @@
}; };
trouble.enable = true; trouble.enable = true;
typst-preview.enable = true;
which-key.enable = true; which-key.enable = true;
}; };
}; };

View file

@ -7,6 +7,29 @@
lsp = { lsp = {
inlayHints.enable = true; inlayHints.enable = true;
servers = { 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; bashls.enable = true;
html.enable = true; html.enable = true;
jqls.enable = true; jqls.enable = true;
@ -19,33 +42,55 @@
metals.enable = true; metals.enable = true;
nil_ls.enable = true; nil_ls.enable = true;
nixd.enable = true; nixd.enable = true;
pyrefly.enable = true;
rust_analyzer.enable = true; rust_analyzer.enable = true;
sourcekit.enable = true; sourcekit = {
enable = true;
settings = {
cmd = [
"xcrun"
"sourcekit-lsp"
];
};
};
tinymist.enable = true;
ts_ls.enable = true; ts_ls.enable = true;
yamlls.enable = true; yamlls.enable = true;
}; };
keymaps = keymaps = [
lib.mapAttrsToList {
( key = "<leader>k";
key: props: action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end";
{ }
inherit key; {
options.silent = true; key = "<leader>j";
} action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end";
// props }
) {
{ key = "gd";
"<leader>k".action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end"; lspBufAction = "definition";
"<leader>j".action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end"; }
gd.lspBufAction = "definition"; {
gD.lspBufAction = "references"; key = "gD";
gt.lspBufAction = "type_definition"; lspBufAction = "references";
gi.lspBufAction = "implementation"; }
K.lspBufAction = "hover"; {
"<F2>".lspBufAction = "rename"; key = "gt";
}; lspBufAction = "type_definition";
}
{
key = "gi";
lspBufAction = "implementation";
}
{
key = "K";
lspBufAction = "hover";
}
{
key = "<F2>";
lspBufAction = "rename";
}
];
}; };
plugins = { plugins = {

View file

@ -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";
}
];
}

View file

@ -11,6 +11,17 @@
plugins = { plugins = {
luasnip.enable = true; 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 = { lspkind = {
enable = true; enable = true;
@ -19,11 +30,10 @@
enable = true; enable = true;
menu = { menu = {
nvim_lsp = "[LSP]"; nvim_lsp = "[LSP]";
nvim_lua = "[api]";
path = "[path]";
luasnip = "[snip]"; luasnip = "[snip]";
buffer = "[buffer]"; buffer = "[buffer]";
cmp_tabby = "[Tabby]"; path = "[path]";
nvim_lua = "[api]";
}; };
}; };
}; };
@ -31,8 +41,14 @@
cmp = { cmp = {
enable = true; enable = true;
autoEnableSources = true;
settings = { settings = {
performance = {
debounce = 60;
throttle = 30;
fetching_timeout = 200;
};
snippet.expand = '' snippet.expand = ''
function(args) function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
@ -50,13 +66,15 @@
}; };
sources = [ sources = [
{ name = "path"; }
{ name = "nvim_lsp"; } { name = "nvim_lsp"; }
{ name = "luasnip"; } { name = "luasnip"; }
{ {
name = "buffer"; name = "buffer";
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
} }
{ name = "path"; }
{ name = "nvim_lua"; }
{ name = "cmp-nvim-lsp-signature-help"; }
]; ];
}; };
}; };

View file

@ -2,9 +2,10 @@
{ {
imports = [ imports = [
./options.nix ./autocommands.nix
./keymappings.nix
./completion.nix ./completion.nix
./keymappings.nix
./options.nix
./_plugins ./_plugins
]; ];

View file

@ -24,7 +24,7 @@
tabstop = 2; tabstop = 2;
termguicolors = true; termguicolors = true;
undofile = true; undofile = true;
updatetime = 250; updatetime = 100;
wrap = false; wrap = false;
}; };