moved nixvim into own home-manager module.
moved pass store location.
This commit is contained in:
parent
bbc6beb3da
commit
2253c6c34a
28 changed files with 24 additions and 11 deletions
49
modules/home-manager/nvim/lsp/clangd.nix
Normal file
49
modules/home-manager/nvim/lsp/clangd.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.file = {
|
||||
".clangd".text = ''
|
||||
# keeps clangd from choking when it sees a compiler flag for a different
|
||||
# compiler. (sutch as when acting as an lsp for a project that uses GCC.)
|
||||
CompileFlags:
|
||||
Add: -Wno-unknown-warning-option
|
||||
Remove: [-m*, -f*]
|
||||
'';
|
||||
".clang-format".text = ''
|
||||
---
|
||||
#this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other.
|
||||
PointerAlignment: Left
|
||||
ColumnLimit: 80
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BreakBeforeBraces: Attach
|
||||
AlignOperands: Align
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
...
|
||||
'';
|
||||
"work/.clang-format" = lib.mkIf config.host.git.workProfile.enable {
|
||||
text = ''
|
||||
---
|
||||
#this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other.
|
||||
PointerAlignment: Left
|
||||
ColumnLimit: 80
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeBinaryOperators: None
|
||||
...
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
208
modules/home-manager/nvim/lsp/default.nix
Normal file
208
modules/home-manager/nvim/lsp/default.nix
Normal file
|
@ -0,0 +1,208 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
host.nvim.enable-lsp = lib.mkEnableOption "nvim lsp";
|
||||
};
|
||||
|
||||
config =
|
||||
lib.mkIf config.host.nvim.enable-lsp
|
||||
{
|
||||
host.nvim.enable-completions = true;
|
||||
programs.nixvim = {
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
bashls.enable = true;
|
||||
clangd.enable = true;
|
||||
lua-ls.enable = true;
|
||||
nil_ls.enable = true;
|
||||
nil_ls.settings.formatting.command = ["alejandra"];
|
||||
nushell.enable = true;
|
||||
pyright.enable = true;
|
||||
ruff-lsp.enable = true;
|
||||
rust-analyzer = {
|
||||
enable = true;
|
||||
installCargo = true;
|
||||
installRustc = true;
|
||||
};
|
||||
texlab.enable = true;
|
||||
typst-lsp.enable = true;
|
||||
taplo.enable = true;
|
||||
yamlls.enable = true;
|
||||
marksman.enable = true;
|
||||
jsonls.enable = true;
|
||||
hls.enable = true;
|
||||
};
|
||||
};
|
||||
plugins.cmp.settings.sources = [
|
||||
{name = "nvim_lsp";}
|
||||
];
|
||||
plugins.which-key.registrations = {
|
||||
"<leader>l" = "+lsp";
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
action = "vim.lsp.buf.declaration";
|
||||
key = "<leader>lc";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "declaration";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.definition";
|
||||
key = "<leader>ld";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "definition";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.hover";
|
||||
key = "<leader>lh";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "hover";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.implementation";
|
||||
key = "<leader>li";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "implementation";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.signature_help";
|
||||
key = "<leader>ls";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "signature_help";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.add_workspace_folder";
|
||||
key = "<leader>lwa";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "add folder";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.remove_workspace_folder";
|
||||
key = "<leader>lwr";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "remove folder";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.list_workspace_folders";
|
||||
key = "<leader>lw";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "workspace";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.rename";
|
||||
key = "<leader>lr";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "rename";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.code_action";
|
||||
key = "<leader>la";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "code action";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.lsp.buf.references";
|
||||
key = "<leader>le";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "list references";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "function() vim.lsp.buf.format{async=true} end";
|
||||
key = "<leader>lm";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "format buffer";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.diagnostic.open_float";
|
||||
key = "<leader>lo";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "open float";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.diagnostic.goto_next";
|
||||
key = "]d";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "next diagnostic";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = "vim.diagnostic.goto_prev";
|
||||
key = "[d";
|
||||
lua = true;
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "prev diagnostic";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
alejandra
|
||||
];
|
||||
};
|
||||
imports = [
|
||||
./rust-tools.nix
|
||||
./clangd.nix
|
||||
];
|
||||
}
|
16
modules/home-manager/nvim/lsp/rust-tools.nix
Normal file
16
modules/home-manager/nvim/lsp/rust-tools.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config =
|
||||
lib.mkIf config.host.nvim.enable-lsp
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.rust-tools = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue