Initial commit
This commit is contained in:
commit
430194beda
109 changed files with 9066 additions and 0 deletions
54
modules/nixos/nixvim/plugins/cmp.nix
Normal file
54
modules/nixos/nixvim/plugins/cmp.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.cmp;
|
||||
|
||||
inherit (lib) mkDefault mkIf;
|
||||
in
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
cmp = {
|
||||
enable = mkDefault true;
|
||||
settings = {
|
||||
autoEnableSources = mkDefault true;
|
||||
experimental.ghost_text = mkDefault true;
|
||||
snippet.expand = mkDefault "luasnip";
|
||||
formatting.fields = mkDefault [
|
||||
"kind"
|
||||
"abbr"
|
||||
"menu"
|
||||
];
|
||||
sources = [
|
||||
{ name = "git"; }
|
||||
{ name = "nvim_lsp"; }
|
||||
{
|
||||
name = "buffer";
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
keywordLength = 3;
|
||||
}
|
||||
{
|
||||
name = "path";
|
||||
keywordLength = 3;
|
||||
}
|
||||
{ name = "luasnip"; }
|
||||
];
|
||||
mapping = {
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||
};
|
||||
};
|
||||
};
|
||||
cmp-cmdline = mkIf plugin.enable { enable = mkDefault false; }; # autocomplete for cmdline
|
||||
cmp_luasnip = mkIf plugin.enable { enable = mkDefault true; };
|
||||
luasnip = mkIf plugin.enable { enable = mkDefault true; };
|
||||
cmp-treesitter = mkIf (plugin.enable && cfg.plugins.treesitter.enable) { enable = mkDefault true; };
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/nixos/nixvim/plugins/default.nix
Normal file
18
modules/nixos/nixvim/plugins/default.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./cmp.nix
|
||||
./lsp.nix
|
||||
./lualine.nix
|
||||
./telescope.nix
|
||||
# ./treesitter.nix # HOTFIX: does not build
|
||||
./trouble.nix
|
||||
];
|
||||
|
||||
config.programs.nixvim.plugins = {
|
||||
markdown-preview.enable = lib.mkDefault true;
|
||||
# warning: Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled. This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable`
|
||||
web-devicons.enable = true;
|
||||
};
|
||||
}
|
||||
69
modules/nixos/nixvim/plugins/lsp.nix
Normal file
69
modules/nixos/nixvim/plugins/lsp.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.lsp;
|
||||
|
||||
inherit (lib) mkDefault mkIf optional;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
lsp-format = mkIf plugin.enable { enable = mkDefault true; };
|
||||
|
||||
lsp = {
|
||||
enable = mkDefault true;
|
||||
postConfig = "";
|
||||
keymaps = {
|
||||
silent = mkDefault true;
|
||||
diagnostic = mkDefault {
|
||||
# Navigate in diagnostics
|
||||
"<leader>k" = "goto_prev";
|
||||
"<leader>j" = "goto_next";
|
||||
};
|
||||
|
||||
lspBuf = mkDefault {
|
||||
gd = "definition";
|
||||
gD = "references";
|
||||
gt = "type_definition";
|
||||
gi = "implementation";
|
||||
K = "hover";
|
||||
"<F2>" = "rename";
|
||||
};
|
||||
};
|
||||
|
||||
servers = {
|
||||
bashls.enable = mkDefault true;
|
||||
clangd.enable = mkDefault true;
|
||||
cssls.enable = mkDefault true;
|
||||
dockerls.enable = mkDefault true;
|
||||
gopls.enable = mkDefault true;
|
||||
html.enable = mkDefault true;
|
||||
jsonls.enable = mkDefault true;
|
||||
nixd.enable = mkDefault true;
|
||||
pyright.enable = mkDefault true;
|
||||
rust_analyzer = {
|
||||
enable = mkDefault true;
|
||||
installCargo = mkDefault true;
|
||||
installRustc = mkDefault true;
|
||||
settings.rustfmt.overrideCommand = mkDefault [
|
||||
"${pkgs.rustfmt}/bin/rustfmt --edition 2021" # --config tab_spaces=2"
|
||||
];
|
||||
};
|
||||
texlab.enable = mkDefault true;
|
||||
vhdl_ls.enable = mkDefault true;
|
||||
yamlls.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = optional (cfg.enable && plugin.servers.nixd.enable) pkgs.nixfmt;
|
||||
};
|
||||
}
|
||||
18
modules/nixos/nixvim/plugins/lualine.nix
Normal file
18
modules/nixos/nixvim/plugins/lualine.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.lualine;
|
||||
|
||||
inherit (lib) mkDefault;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
plugins.lualine = {
|
||||
enable = mkDefault true;
|
||||
settings.options.icons_enabled = mkDefault false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
52
modules/nixos/nixvim/plugins/telescope.nix
Normal file
52
modules/nixos/nixvim/plugins/telescope.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.telescope;
|
||||
|
||||
inherit (lib) mkDefault optionals;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
plugins.telescope = {
|
||||
enable = mkDefault true;
|
||||
extensions = {
|
||||
file-browser.enable = mkDefault true;
|
||||
fzf-native.enable = mkDefault true;
|
||||
live-grep-args.enable = mkDefault true;
|
||||
manix.enable = mkDefault true;
|
||||
};
|
||||
keymaps = mkDefault {
|
||||
"<C-e>" = "file_browser";
|
||||
"<C-p>" = "git_files";
|
||||
"<leader>bl" = "buffers";
|
||||
"<leader>fd" = "diagnostics";
|
||||
"<leader>ff" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
"<leader>fh" = "help_tags";
|
||||
"<leader>fm" = "man_pages";
|
||||
"<leader>fn" = "manix";
|
||||
"<leader>fo" = "oldfiles";
|
||||
"<space>fb" = "file_browser";
|
||||
};
|
||||
};
|
||||
keymaps = optionals plugin.enable [
|
||||
{
|
||||
key = "<C-f>";
|
||||
action = ":lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>";
|
||||
mode = "n";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
home.packages = optionals plugin.enable [
|
||||
pkgs.ripgrep # for "live_grep"
|
||||
];
|
||||
};
|
||||
}
|
||||
42
modules/nixos/nixvim/plugins/treesitter.nix
Normal file
42
modules/nixos/nixvim/plugins/treesitter.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.treesitter;
|
||||
|
||||
cc = "${pkgs.gcc}/bin/gcc";
|
||||
|
||||
inherit (lib) mkDefault mkIf;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
plugins.treesitter = {
|
||||
enable = mkDefault true;
|
||||
nixvimInjections = mkDefault true;
|
||||
settings = {
|
||||
folding.enable = mkDefault true;
|
||||
highlight.enable = mkDefault true;
|
||||
indent.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
plugins.treesitter-context = mkIf plugin.enable { enable = mkDefault true; };
|
||||
plugins.treesitter-textobjects = mkIf plugin.enable { enable = mkDefault true; };
|
||||
};
|
||||
|
||||
# Fix for: ERROR `cc` executable not found.
|
||||
home.sessionVariables = mkIf plugin.enable {
|
||||
CC = mkDefault cc;
|
||||
};
|
||||
|
||||
# Fix for: WARNING `tree-sitter` executable not found
|
||||
home.packages = mkIf plugin.enable [
|
||||
plugin.package
|
||||
];
|
||||
};
|
||||
}
|
||||
43
modules/nixos/nixvim/plugins/trouble.nix
Normal file
43
modules/nixos/nixvim/plugins/trouble.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.nixvim;
|
||||
plugin = cfg.plugins.trouble;
|
||||
|
||||
inherit (lib) mkDefault mkIf;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
plugins.trouble = {
|
||||
enable = mkDefault true;
|
||||
};
|
||||
keymaps = mkIf plugin.enable [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xq";
|
||||
action = "<CMD>Trouble qflist toggle<CR>";
|
||||
options = {
|
||||
desc = "Trouble quifick toggle";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xl";
|
||||
action = "<CMD>Trouble loclist toggle<CR>";
|
||||
options = {
|
||||
desc = "Trouble loclist toggle";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xx";
|
||||
action = "<CMD>Trouble diagnostics toggle<CR>";
|
||||
options = {
|
||||
desc = "Trouble diagnostics toggle";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue