using my nixvim config now in separate repo

This commit is contained in:
Christoph Hollizeck 2024-03-30 22:42:10 +01:00
parent cf55ba3d70
commit f13fe6fc3a
4 changed files with 594 additions and 325 deletions

View file

@ -4,6 +4,7 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
@ -39,11 +40,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1696426674,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,11 +56,11 @@
"flake-compat_3": { "flake-compat_3": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1668681692, "lastModified": 1673956053,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -85,6 +86,38 @@
} }
}, },
"flake-compat_5": { "flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_7": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1650374568, "lastModified": 1650374568,
@ -103,6 +136,7 @@
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
@ -141,7 +175,25 @@
}, },
"flake-utils-plus": { "flake-utils-plus": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3" "flake-utils": "flake-utils_4"
},
"locked": {
"lastModified": 1696331477,
"narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"type": "github"
}
},
"flake-utils-plus_2": {
"inputs": {
"flake-utils": "flake-utils_5"
}, },
"locked": { "locked": {
"lastModified": 1657226504, "lastModified": 1657226504,
@ -157,9 +209,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils-plus_2": { "flake-utils-plus_3": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4" "flake-utils": "flake-utils_6"
}, },
"locked": { "locked": {
"lastModified": 1696331477, "lastModified": 1696331477,
@ -179,6 +231,24 @@
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": { "locked": {
"lastModified": 1685518550, "lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
@ -193,7 +263,25 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"locked": { "locked": {
"lastModified": 1644229661, "lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
@ -208,9 +296,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": { "flake-utils_6": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1694529238,
@ -227,6 +315,29 @@
} }
}, },
"gitignore": { "gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
@ -272,6 +383,7 @@
"home-manager_2": { "home-manager_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
@ -293,16 +405,17 @@
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1711591334, "lastModified": 1711763326,
"narHash": "sha256-9d5ilxxq4CXw44eFw8VFrRneAKex7D8xjn95mwZjgf4=", "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "f0dd0838c3558b59dc3b726d8ab89f5b5e35c297", "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -362,7 +475,47 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable": {
"locked": {
"lastModified": 1704290814,
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": { "nixvim": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nixvim": "nixvim_2",
"pre-commit-hooks": "pre-commit-hooks_2",
"snowfall-lib": "snowfall-lib",
"unstable": "unstable"
},
"locked": {
"lastModified": 1711834191,
"narHash": "sha256-P0WKgVpH8+QpKUcrhvfMiEjYB2SCezkKgBuqU24R/aA=",
"owner": "Daholli",
"repo": "nixvim",
"rev": "b781ea53c3926c396ef13c41dedbc0e03aed41bb",
"type": "github"
},
"original": {
"owner": "Daholli",
"repo": "nixvim",
"type": "github"
}
},
"nixvim_2": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -370,16 +523,17 @@
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixvim",
"unstable"
], ],
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1711630555, "lastModified": 1711809391,
"narHash": "sha256-jslStwDlRwVZLwcFkExWegOGYv/Dn9q7yoocUX7AsIg=", "narHash": "sha256-/nGV6P8nB/R/ysbl1KQIKIwp1mQPXxtnoEd+pf3X+nw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "acb917fbf2bc9ce9c556516d8a1f257709b3cf1e", "rev": "0c16f59202c5062d12ef9cd4560cc9fca9d99f9a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -394,14 +548,41 @@
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-stable": [ "nixpkgs-stable": [
"nixvim",
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": {
"lastModified": 1711760932,
"narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "c11e43aed6f17336c25cd120eac886b96c455731",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": { "locked": {
"lastModified": 1703939133, "lastModified": 1703939133,
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
@ -424,17 +605,17 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixvim": "nixvim", "nixvim": "nixvim",
"snowfall-flake": "snowfall-flake", "snowfall-flake": "snowfall-flake",
"snowfall-lib": "snowfall-lib_2", "snowfall-lib": "snowfall-lib_3",
"unstable": "unstable" "unstable": "unstable_2"
} }
}, },
"snowfall-flake": { "snowfall-flake": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_5",
"nixpkgs": [ "nixpkgs": [
"unstable" "unstable"
], ],
"snowfall-lib": "snowfall-lib" "snowfall-lib": "snowfall-lib_2"
}, },
"locked": { "locked": {
"lastModified": 1709228099, "lastModified": 1709228099,
@ -454,6 +635,29 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_4",
"flake-utils-plus": "flake-utils-plus", "flake-utils-plus": "flake-utils-plus",
"nixpkgs": [
"nixvim",
"unstable"
]
},
"locked": {
"lastModified": 1696432959,
"narHash": "sha256-oJQZv2MYyJaVyVJY5IeevzqpGvMGKu5pZcCCJvb+xjc=",
"owner": "snowfallorg",
"repo": "lib",
"rev": "92803a029b5314d4436a8d9311d8707b71d9f0b6",
"type": "github"
},
"original": {
"owner": "snowfallorg",
"repo": "lib",
"type": "github"
}
},
"snowfall-lib_2": {
"inputs": {
"flake-compat": "flake-compat_6",
"flake-utils-plus": "flake-utils-plus_2",
"nixpkgs": [ "nixpkgs": [
"snowfall-flake", "snowfall-flake",
"nixpkgs" "nixpkgs"
@ -473,10 +677,10 @@
"type": "github" "type": "github"
} }
}, },
"snowfall-lib_2": { "snowfall-lib_3": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_5", "flake-compat": "flake-compat_7",
"flake-utils-plus": "flake-utils-plus_2", "flake-utils-plus": "flake-utils-plus_3",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -540,7 +744,53 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"unstable": { "unstable": {
"locked": {
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"unstable_2": {
"locked": { "locked": {
"lastModified": 1711333969, "lastModified": 1711333969,
"narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=", "narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=",

View file

@ -23,7 +23,7 @@
# The nix way of configuring vim # The nix way of configuring vim
nixvim = { nixvim = {
url = "github:nix-community/nixvim"; url = "github:Daholli/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
@ -59,12 +59,12 @@
overlays = with inputs; [ overlays = with inputs; [
snowfall-flake.overlays.default snowfall-flake.overlays.default
nixvim.overlays.default
]; ];
systems.modules.nixos = with inputs; [ systems.modules.nixos = with inputs; [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
nix-ld.nixosModules.nix-ld nix-ld.nixosModules.nix-ld
nixvim.nixosModules.nixvim
]; ];
}; };
} }

View file

@ -14,302 +14,6 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.nixvim = { environment.systemPackages = with pkgs; [less wyrdgard.neovim];
enable = true;
colorschemes.tokyonight = enabled;
globals.mapleader = " ";
clipboard.providers.wl-copy = enabled;
options = {
number = true;
relativenumber = true;
shiftwidth = 4;
};
autoCmd = [
{
event = "FileType";
pattern = "nix";
command = "setlocal tabstop=2 shiftwidth=2";
}
];
keymaps = [
{
action = "<cmd>Ex<CR>";
key = "<leader>e";
options.desc = "Open Explorer";
}
{
mode = "n";
action = "<cmd>w<CR>";
key = "<C-s>";
options.desc = "Save";
}
{
mode = "n";
action = "<cmd>noh<CR>";
key = "<esc>";
options.silent = true;
}
{
mode = "n";
action = "<cmd>UndotreeToggle<CR>";
key = "<leader>ut";
options.desc = "Toggle Undotree";
}
{
mode = "n";
action = "<cmd>UndotreeToggle<CR>";
key = "<leader>uf";
options.desc = "Focus Undotree";
}
];
plugins = {
telescope = {
enable = true;
keymaps = {
"<leader>sr" = {
action = "oldfiles";
desc = "[s]earch [r]ecent";
};
"<leader>sk" = {
action = "keymaps";
desc = "[s]earch [k]eys";
};
"<leader>sg" = {
action = "live_grep";
desc = "[s]earch [g]rep";
};
};
};
harpoon = {
enable = true;
enableTelescope = true;
keymaps = {
addFile = "<leader>a";
toggleQuickMenu = "<leader>ha";
navFile = {
"1" = "<C-1>";
"2" = "<C-2>";
"3" = "<C-3>";
"4" = "<C-4>";
};
};
};
treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
treesitter-context.enable = true;
lualine.enable = true;
copilot-lua = {
panel.enabled = false;
suggestion.enabled = false;
};
nix.enable = true;
nix-develop.enable = true;
nvim-autopairs.enable = true;
rainbow-delimiters = {enable = true;};
nvim-colorizer.enable = true;
undotree.enable = true;
which-key = {enable = true;};
trouble.enable = true;
markdown-preview.enable = true;
dashboard = {enable = true;};
auto-save = {
enable = true;
enableAutoSave = true;
};
## cmp extract into file
luasnip.enable = true;
cmp-buffer = {enable = true;};
cmp-emoji = {enable = true;};
cmp-nvim-lsp = {enable = true;};
cmp-path = {enable = true;};
cmp_luasnip = {enable = true;};
cmp = {
enable = true;
settings = {
snippet.expand = "luasnip";
sources = [
{name = "nvim_lsp";}
{name = "luasnip";}
{name = "copilot";}
{
name = "buffer";
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
{name = "nvim_lua";}
{name = "path";}
];
formatting = {
fields = ["abbr" "kind" "menu"];
format =
# lua
''
function(_, item)
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
local icon = icons[item.kind] or ""
item.kind = string.format("%s %s", icon, item.kind or "")
return item
end
'';
};
window = {
completion = {
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
scrollbar = false;
sidePadding = 0;
border = ["" "" "" "" "" "" "" ""];
};
settings.documentation = {
border = ["" "" "" "" "" "" "" ""];
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
};
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
"<Tab>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end
'';
"<S-Tab>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end
'';
};
};
};
## lsp
lsp = {
enable = true;
servers = {
fsautocomplete.enable = true;
nixd.enable = true;
};
keymaps.lspBuf = {
"<leader>gd" = "definition";
"<leader>gD" = "references";
"<leader>gt" = "type_definition";
"<leader>gi" = "implementation";
"<leader>K" = "hover";
};
};
rust-tools.enable = true;
## none-ls
none-ls = {
enable = true;
sources = {
diagnostics = {statix.enable = true;};
formatting = {
nixfmt.enable = true;
markdownlint.enable = true;
shellharden.enable = true;
shfmt.enable = true;
};
};
};
};
};
}; };
} }

View file

@ -0,0 +1,315 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.wyrdgard; let
cfg = config.wyrdgard.apps.cli-apps.nixvim;
in {
options.wyrdgard.apps.cli-apps.nixvim = with types; {
enable = mkBoolOpt true "Whether to enable nixvim or not (Default true)";
};
config = mkIf cfg.enable {
programs.nixvim = {
enable = true;
colorschemes.tokyonight = enabled;
globals.mapleader = " ";
clipboard.providers.wl-copy = enabled;
options = {
number = true;
relativenumber = true;
shiftwidth = 4;
};
autoCmd = [
{
event = "FileType";
pattern = "nix";
command = "setlocal tabstop=2 shiftwidth=2";
}
];
keymaps = [
{
action = "<cmd>Ex<CR>";
key = "<leader>e";
options.desc = "Open Explorer";
}
{
mode = "n";
action = "<cmd>w<CR>";
key = "<C-s>";
options.desc = "Save";
}
{
mode = "n";
action = "<cmd>noh<CR>";
key = "<esc>";
options.silent = true;
}
{
mode = "n";
action = "<cmd>UndotreeToggle<CR>";
key = "<leader>ut";
options.desc = "Toggle Undotree";
}
{
mode = "n";
action = "<cmd>UndotreeToggle<CR>";
key = "<leader>uf";
options.desc = "Focus Undotree";
}
];
plugins = {
telescope = {
enable = true;
keymaps = {
"<leader>sr" = {
action = "oldfiles";
desc = "[s]earch [r]ecent";
};
"<leader>sk" = {
action = "keymaps";
desc = "[s]earch [k]eys";
};
"<leader>sg" = {
action = "live_grep";
desc = "[s]earch [g]rep";
};
};
};
harpoon = {
enable = true;
enableTelescope = true;
keymaps = {
addFile = "<leader>a";
toggleQuickMenu = "<leader>ha";
navFile = {
"1" = "<C-1>";
"2" = "<C-2>";
"3" = "<C-3>";
"4" = "<C-4>";
};
};
};
treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
treesitter-context.enable = true;
lualine.enable = true;
copilot-lua = {
panel.enabled = false;
suggestion.enabled = false;
};
nix.enable = true;
nix-develop.enable = true;
nvim-autopairs.enable = true;
rainbow-delimiters = {enable = true;};
nvim-colorizer.enable = true;
undotree.enable = true;
which-key = {enable = true;};
trouble.enable = true;
markdown-preview.enable = true;
dashboard = {enable = true;};
auto-save = {
enable = true;
enableAutoSave = true;
};
## cmp extract into file
luasnip.enable = true;
cmp-buffer = {enable = true;};
cmp-emoji = {enable = true;};
cmp-nvim-lsp = {enable = true;};
cmp-path = {enable = true;};
cmp_luasnip = {enable = true;};
cmp = {
enable = true;
settings = {
snippet.expand = "luasnip";
sources = [
{name = "nvim_lsp";}
{name = "luasnip";}
{name = "copilot";}
{
name = "buffer";
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
{name = "nvim_lua";}
{name = "path";}
];
formatting = {
fields = ["abbr" "kind" "menu"];
format =
# lua
''
function(_, item)
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
local icon = icons[item.kind] or ""
item.kind = string.format("%s %s", icon, item.kind or "")
return item
end
'';
};
window = {
completion = {
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
scrollbar = false;
sidePadding = 0;
border = ["" "" "" "" "" "" "" ""];
};
settings.documentation = {
border = ["" "" "" "" "" "" "" ""];
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
};
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
"<Tab>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end
'';
"<S-Tab>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end
'';
};
};
};
## lsp
lsp = {
enable = true;
servers = {
fsautocomplete.enable = true;
nixd.enable = true;
};
keymaps.lspBuf = {
"<leader>gd" = "definition";
"<leader>gD" = "references";
"<leader>gt" = "type_definition";
"<leader>gi" = "implementation";
"<leader>K" = "hover";
};
};
rust-tools.enable = true;
## none-ls
none-ls = {
enable = true;
sources = {
diagnostics = {statix.enable = true;};
formatting = {
nixfmt.enable = true;
markdownlint.enable = true;
shellharden.enable = true;
shfmt.enable = true;
};
};
};
};
};
};
}