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 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)
'';

View file

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

View file

@ -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:
keymaps = [
{
inherit key;
options.silent = true;
key = "<leader>k";
action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end";
}
// props
)
{
"<leader>k".action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end";
"<leader>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";
"<F2>".lspBufAction = "rename";
};
key = "<leader>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 = "<F2>";
lspBufAction = "rename";
}
];
};
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 = {
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"; }
];
};
};

View file

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

View file

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