mirror of
https://github.com/softinio/nix-config.git
synced 2025-10-19 03:26:40 -07:00
re-organize nixvim
This commit is contained in:
parent
7584b9ebfc
commit
10e3123b7f
22 changed files with 480 additions and 219 deletions
9
programs/nixvim/plugins/lsp/default.nix
Normal file
9
programs/nixvim/plugins/lsp/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./servers.nix
|
||||
./keymaps.nix
|
||||
./formatting.nix
|
||||
];
|
||||
}
|
19
programs/nixvim/plugins/lsp/formatting.nix
Normal file
19
programs/nixvim/plugins/lsp/formatting.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
43
programs/nixvim/plugins/lsp/keymaps.nix
Normal file
43
programs/nixvim/plugins/lsp/keymaps.nix
Normal 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";
|
||||
}
|
||||
];
|
||||
}
|
79
programs/nixvim/plugins/lsp/servers.nix
Normal file
79
programs/nixvim/plugins/lsp/servers.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue