re-organize nixvim

This commit is contained in:
Salar Rahmanian 2025-10-05 15:47:32 -07:00
parent 7584b9ebfc
commit 10e3123b7f
22 changed files with 480 additions and 219 deletions

View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./servers.nix
./keymaps.nix
./formatting.nix
];
}

View file

@ -0,0 +1,19 @@
{ ... }:
{
programs.nixvim = {
# Diagnostics display
diagnostic.settings.virtual_text = true;
plugins = {
# Auto-format on save
lsp-format = {
enable = true;
lspServersToEnable = "all";
};
# Sane defaults for all servers
lspconfig.enable = true;
};
};
}

View file

@ -0,0 +1,43 @@
{ ... }:
{
programs.nixvim.lsp.keymaps = [
# Diagnostics navigation
{
key = "<leader>k";
action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end";
}
{
key = "<leader>j";
action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end";
}
# LSP navigation
{
key = "gd";
lspBufAction = "definition";
}
{
key = "gD";
lspBufAction = "references";
}
{
key = "gt";
lspBufAction = "type_definition";
}
{
key = "gi";
lspBufAction = "implementation";
}
# Documentation and refactoring
{
key = "K";
lspBufAction = "hover";
}
{
key = "<F2>";
lspBufAction = "rename";
}
];
}

View file

@ -0,0 +1,79 @@
{ ... }:
{
programs.nixvim.lsp = {
inlayHints.enable = true;
servers = {
# Python
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;
};
};
};
# Shell scripting
bashls.enable = true;
# Web development
html.enable = true;
jsonls.enable = true;
yamlls.enable = true;
ts_ls.enable = true;
# Query languages
jqls.enable = true;
# Lua
lua_ls = {
enable = true;
settings.settings.diagnostics.globals = [ "vim" ];
};
# Documentation
marksman.enable = true;
# Scala
metals.enable = true;
# Nix
nil_ls.enable = true;
nixd.enable = true;
# Rust
rust_analyzer.enable = true;
# Swift/iOS development
sourcekit = {
enable = true;
settings = {
cmd = [
"xcrun"
"sourcekit-lsp"
];
};
};
# Typst
tinymist.enable = true;
};
};
}