refactor
This commit is contained in:
139
modules/home/devtools/helix/default.nix
Normal file
139
modules/home/devtools/helix/default.nix
Normal file
@@ -0,0 +1,139 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.home.devtools.helix;
|
||||
in {
|
||||
imports = [
|
||||
./lang.nix
|
||||
./theme.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
home.devtools.helix.enable = mkEnableOption "Enable helix";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
# package = inputs.helix.packages.${pkgs.system}.default;
|
||||
package = inputs.helix-flake.packages.${pkgs.system}.default;
|
||||
|
||||
settings = {
|
||||
theme = "gruvbox_custom";
|
||||
editor = {
|
||||
color-modes = true;
|
||||
scrolloff = 0;
|
||||
cursorline = true;
|
||||
completion-replace = true;
|
||||
cursor-shape = {
|
||||
insert = "bar";
|
||||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
indent-guides.render = false;
|
||||
inline-diagnostics = {
|
||||
cursor-line = "hint";
|
||||
other-lines = "error";
|
||||
};
|
||||
lsp = {
|
||||
display-messages = true;
|
||||
display-inlay-hints = true;
|
||||
};
|
||||
gutters = ["diagnostics" "line-numbers" "spacer" "diff"];
|
||||
statusline = {
|
||||
separator = "of";
|
||||
left = [
|
||||
"mode"
|
||||
"selections"
|
||||
"file-type"
|
||||
"register"
|
||||
"spinner"
|
||||
"diagnostics"
|
||||
];
|
||||
center = ["file-name"];
|
||||
right = [
|
||||
"file-encoding"
|
||||
"file-line-ending"
|
||||
"position-percentage"
|
||||
"spacer"
|
||||
"separator"
|
||||
"total-line-numbers"
|
||||
];
|
||||
mode = {
|
||||
normal = "NOR";
|
||||
insert = "INS";
|
||||
select = "SEL";
|
||||
};
|
||||
};
|
||||
true-color = true;
|
||||
whitespace.characters = {
|
||||
newline = "↴";
|
||||
tab = "⇥";
|
||||
};
|
||||
};
|
||||
|
||||
keys = let
|
||||
spaceMode = {
|
||||
space = "file_picker";
|
||||
n = "global_search";
|
||||
f = ":format";
|
||||
c = "toggle_comments";
|
||||
t = {
|
||||
d = "goto_type_definition";
|
||||
i = "goto_implementation";
|
||||
r = "goto_reference";
|
||||
t = "goto_definition";
|
||||
w = "trim_selections";
|
||||
};
|
||||
x = ":buffer-close";
|
||||
w = ":w";
|
||||
q = ":q";
|
||||
y = "yank";
|
||||
p = "paste_after";
|
||||
P = "paste_before";
|
||||
R = "replace_with_yanked";
|
||||
};
|
||||
in {
|
||||
normal = {
|
||||
d = {
|
||||
d = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "delete_selection"];
|
||||
s = ["surround_delete"];
|
||||
};
|
||||
x = "delete_selection";
|
||||
y = {
|
||||
y = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "normal_mode" "collapse_selection"];
|
||||
d = ":yank-diagnostic";
|
||||
};
|
||||
Y = ["extend_to_line_end" "yank_main_selection_to_clipboard" "collapse_selection"];
|
||||
P = ["paste_clipboard_before" "collapse_selection"];
|
||||
p = ["paste_clipboard_after" "collapse_selection"];
|
||||
C-a = "select_all";
|
||||
del = "delete_selection";
|
||||
space = spaceMode;
|
||||
};
|
||||
insert = {
|
||||
C-v = "paste_clipboard_after";
|
||||
C-c = "yank_to_clipboard";
|
||||
C-x = "completion";
|
||||
del = "delete_selection";
|
||||
esc = ["collapse_selection" "normal_mode"];
|
||||
};
|
||||
select = {
|
||||
space = spaceMode;
|
||||
d = ["yank_main_selection_to_clipboard" "delete_selection"];
|
||||
x = ["yank_main_selection_to_clipboard" "delete_selection"];
|
||||
y = ["yank_main_selection_to_clipboard" "normal_mode" "flip_selections" "collapse_selection"];
|
||||
Y = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "goto_line_start" "collapse_selection" "normal_mode"];
|
||||
p = ["replace_selections_with_clipboard"];
|
||||
P = ["paste_clipboard_before"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
225
modules/home/devtools/helix/lang.nix
Normal file
225
modules/home/devtools/helix/lang.nix
Normal file
@@ -0,0 +1,225 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.helix.languages = {
|
||||
language = let
|
||||
deno = lang: {
|
||||
command = lib.getExe pkgs.deno;
|
||||
args = ["fmt" "-" "--ext" lang];
|
||||
};
|
||||
|
||||
prettier = lang: {
|
||||
command = lib.getExe pkgs.nodePackages.prettier;
|
||||
args = ["--parser" lang];
|
||||
};
|
||||
prettierLangs = map (e: {
|
||||
name = e;
|
||||
formatter = prettier e;
|
||||
});
|
||||
langs = ["css" "scss" "html"];
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "bash";
|
||||
auto-format = true;
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.shfmt;
|
||||
args = ["-i" "2"];
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "clojure";
|
||||
injection-regex = "(clojure|clj|edn|boot|yuck)";
|
||||
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
|
||||
}
|
||||
{
|
||||
name = "cmake";
|
||||
auto-format = true;
|
||||
language-servers = ["cmake-language-server"];
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.cmake-format;
|
||||
args = ["-"];
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "lua";
|
||||
auto-format = true;
|
||||
language-servers = ["lua-language-server"];
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.stylua;
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "javascript";
|
||||
auto-format = true;
|
||||
language-servers = ["dprint" "typescript-language-server"];
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
auto-format = true;
|
||||
file-types = ["nix"];
|
||||
language-servers = ["nil"];
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.alejandra;
|
||||
args = ["-q"];
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "json";
|
||||
formatter = deno "json";
|
||||
}
|
||||
{
|
||||
name = "common-lisp";
|
||||
file-types = ["kbd"];
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "markdown";
|
||||
auto-format = true;
|
||||
formatter = deno "md";
|
||||
}
|
||||
{
|
||||
name = "python";
|
||||
language-servers = ["pylsp"];
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.black;
|
||||
args = ["-" "--quiet" "--line-length 100"];
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "typescript";
|
||||
auto-format = true;
|
||||
language-servers = ["dprint" "typescript-language-server"];
|
||||
}
|
||||
{
|
||||
name = "php";
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "css";
|
||||
auto-format = true;
|
||||
language-servers = ["vscode-css-language-server"];
|
||||
}
|
||||
{
|
||||
name = "rust";
|
||||
auto-format = true;
|
||||
file-types = ["rs"];
|
||||
language-servers = ["rust-analyzer"];
|
||||
formatter = {
|
||||
command = lib.getExe pkgs.rustfmt;
|
||||
};
|
||||
}
|
||||
]
|
||||
++ prettierLangs langs;
|
||||
|
||||
language-server = {
|
||||
gpt = {
|
||||
command = "helix-gpt";
|
||||
args = ["--copilotApiKey" "cat /run/agenix/helix-gpt"];
|
||||
};
|
||||
|
||||
bash-language-server = {
|
||||
command = lib.getExe pkgs.bash-language-server;
|
||||
args = ["start"];
|
||||
};
|
||||
|
||||
clangd = {
|
||||
command = "${pkgs.clang-tools}/bin/clangd";
|
||||
clangd.fallbackFlags = ["-std=c++2b"];
|
||||
};
|
||||
|
||||
cmake-language-server = {
|
||||
command = lib.getExe pkgs.cmake-language-server;
|
||||
};
|
||||
|
||||
lua-language-server = {
|
||||
command = lib.getExe pkgs.lua-language-server;
|
||||
};
|
||||
|
||||
deno-lsp = {
|
||||
command = lib.getExe pkgs.deno;
|
||||
args = ["lsp"];
|
||||
environment.NO_COLOR = "1";
|
||||
config.deno = {
|
||||
enable = true;
|
||||
lint = true;
|
||||
unstable = true;
|
||||
suggest = {
|
||||
completeFunctionCalls = false;
|
||||
imports = {hosts."https://deno.land" = true;};
|
||||
};
|
||||
inlayHints = {
|
||||
enumMemberValues.enabled = true;
|
||||
functionLikeReturnTypes.enabled = true;
|
||||
parameterNames.enabled = "all";
|
||||
parameterTypes.enabled = true;
|
||||
propertyDeclarationTypes.enabled = true;
|
||||
variableTypes.enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dprint = {
|
||||
command = lib.getExe pkgs.dprint;
|
||||
args = ["lsp"];
|
||||
};
|
||||
|
||||
nil = {
|
||||
command = lib.getExe pkgs.nil;
|
||||
};
|
||||
|
||||
pyright = {
|
||||
command = "${pkgs.pyright}/bin/pyright-langserver";
|
||||
args = ["--stdio"];
|
||||
config = {
|
||||
reportMissingTypeStubs = false;
|
||||
analysis = {
|
||||
typeCheckingMode = "basic";
|
||||
autoImportCompletions = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
typescript-language-server = {
|
||||
command = lib.getExe pkgs.nodePackages.typescript-language-server;
|
||||
args = ["--stdio"];
|
||||
config = let
|
||||
inlayHints = {
|
||||
includeInlayEnumMemberValueHints = true;
|
||||
includeInlayFunctionLikeReturnTypeHints = true;
|
||||
includeInlayFunctionParameterTypeHints = true;
|
||||
includeInlayParameterNameHints = "all";
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
|
||||
includeInlayPropertyDeclarationTypeHints = true;
|
||||
includeInlayVariableTypeHints = true;
|
||||
};
|
||||
in {
|
||||
typescript-language-server.source = {
|
||||
addMissingImports.ts = true;
|
||||
fixAll.ts = true;
|
||||
organizeImports.ts = true;
|
||||
removeUnusedImports.ts = true;
|
||||
sortImports.ts = true;
|
||||
};
|
||||
|
||||
typescript = {inherit inlayHints;};
|
||||
javascript = {inherit inlayHints;};
|
||||
|
||||
hostInfo = "helix";
|
||||
};
|
||||
};
|
||||
|
||||
vscode-css-language-server = {
|
||||
command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-css-language-server";
|
||||
args = ["--stdio"];
|
||||
config = {
|
||||
provideFormatter = true;
|
||||
css.validate.enable = true;
|
||||
scss.validate.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
201
modules/home/devtools/helix/theme.nix
Normal file
201
modules/home/devtools/helix/theme.nix
Normal file
@@ -0,0 +1,201 @@
|
||||
{
|
||||
programs.helix.themes = {
|
||||
gruvbox_custom = let
|
||||
bg0 = "#32302f";
|
||||
bg1 = "#3c3836";
|
||||
bg2 = "#3c3836";
|
||||
bg3 = "#504945";
|
||||
bg4 = "#504945";
|
||||
fg0 = "#d4be98";
|
||||
red = "#ea6962";
|
||||
orange = "#e78a4e";
|
||||
yellow = "#d8a657";
|
||||
bg_visual_yellow = "#574833";
|
||||
green = "#a9b665";
|
||||
aqua = "#89b482";
|
||||
blue = "#7daea3";
|
||||
purple = "#d3869b";
|
||||
grey0 = "#7c6f64";
|
||||
grey2 = "#a89984";
|
||||
in {
|
||||
"type" = yellow;
|
||||
"constant" = purple;
|
||||
"constant.numeric" = purple;
|
||||
"constant.character.escape" = orange;
|
||||
"string" = green;
|
||||
"string.regexp" = blue;
|
||||
"comment" = grey0;
|
||||
"variable" = fg0;
|
||||
"variable.builtin" = blue;
|
||||
"variable.parameter" = fg0;
|
||||
"variable.other.member" = fg0;
|
||||
"label" = aqua;
|
||||
"punctuation" = grey2;
|
||||
"punctuation.delimiter" = grey2;
|
||||
"punctuation.bracket" = fg0;
|
||||
"keyword" = red;
|
||||
"keyword.directive" = aqua;
|
||||
"operator" = orange;
|
||||
"function" = green;
|
||||
"function.builtin" = blue;
|
||||
"function.macro" = aqua;
|
||||
"tag" = yellow;
|
||||
"namespace" = aqua;
|
||||
"attribute" = aqua;
|
||||
"constructor" = yellow;
|
||||
"module" = blue;
|
||||
"special" = orange;
|
||||
"markup.heading.marker" = grey2;
|
||||
"markup.heading.1" = {
|
||||
fg = red;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.heading.2" = {
|
||||
fg = orange;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.heading.3" = {
|
||||
fg = yellow;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.heading.4" = {
|
||||
fg = green;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.heading.5" = {
|
||||
fg = blue;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.heading.6" = {
|
||||
fg = fg0;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"markup.list" = red;
|
||||
"markup.bold" = {modifiers = ["bold"];};
|
||||
"markup.italic" = {modifiers = ["italic"];};
|
||||
"markup.link.url" = {
|
||||
fg = blue;
|
||||
modifiers = ["underlined"];
|
||||
};
|
||||
"markup.link.text" = purple;
|
||||
"markup.quote" = grey2;
|
||||
"markup.raw" = green;
|
||||
|
||||
"diff.plus" = green;
|
||||
"diff.delta" = orange;
|
||||
"diff.minus" = red;
|
||||
|
||||
"ui.background" = {bg = bg0;};
|
||||
"ui.background.separator" = grey0;
|
||||
"ui.cursor" = {
|
||||
fg = bg0;
|
||||
bg = fg0;
|
||||
};
|
||||
"ui.cursor.match" = {
|
||||
fg = orange;
|
||||
bg = bg_visual_yellow;
|
||||
};
|
||||
"ui.cursor.insert" = {
|
||||
fg = bg0;
|
||||
bg = grey2;
|
||||
};
|
||||
"ui.cursor.select" = {
|
||||
fg = bg0;
|
||||
bg = blue;
|
||||
};
|
||||
"ui.cursorline.primary" = {bg = bg1;};
|
||||
"ui.cursorline.secondary" = {bg = bg1;};
|
||||
"ui.selection" = {bg = bg3;};
|
||||
"ui.linenr" = grey0;
|
||||
"ui.linenr.selected" = fg0;
|
||||
"ui.statusline" = {
|
||||
fg = fg0;
|
||||
bg = bg3;
|
||||
};
|
||||
"ui.statusline.inactive" = {
|
||||
fg = grey0;
|
||||
bg = bg1;
|
||||
};
|
||||
"ui.statusline.normal" = {
|
||||
fg = bg0;
|
||||
bg = fg0;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"ui.statusline.insert" = {
|
||||
fg = bg0;
|
||||
bg = yellow;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"ui.statusline.select" = {
|
||||
fg = bg0;
|
||||
bg = blue;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"ui.bufferline" = {
|
||||
fg = grey0;
|
||||
bg = bg1;
|
||||
};
|
||||
"ui.bufferline.active" = {
|
||||
fg = fg0;
|
||||
bg = bg3;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"ui.popup" = {
|
||||
fg = grey2;
|
||||
bg = bg2;
|
||||
};
|
||||
"ui.window" = {
|
||||
fg = grey0;
|
||||
bg = bg0;
|
||||
};
|
||||
"ui.help" = {
|
||||
fg = fg0;
|
||||
bg = bg2;
|
||||
};
|
||||
"ui.text" = fg0;
|
||||
"ui.text.focus" = fg0;
|
||||
"ui.menu" = {
|
||||
fg = fg0;
|
||||
bg = bg3;
|
||||
};
|
||||
"ui.menu.selected" = {
|
||||
fg = bg0;
|
||||
bg = blue;
|
||||
modifiers = ["bold"];
|
||||
};
|
||||
"ui.virtual.whitespace" = {fg = bg4;};
|
||||
"ui.virtual.indent-guide" = {fg = bg4;};
|
||||
"ui.virtual.ruler" = {bg = bg3;};
|
||||
|
||||
"hint" = blue;
|
||||
"info" = aqua;
|
||||
"warning" = yellow;
|
||||
"error" = red;
|
||||
"diagnostic" = {underline = {style = "curl";};};
|
||||
"diagnostic.hint" = {
|
||||
underline = {
|
||||
color = blue;
|
||||
style = "dotted";
|
||||
};
|
||||
};
|
||||
"diagnostic.info" = {
|
||||
underline = {
|
||||
color = aqua;
|
||||
style = "dotted";
|
||||
};
|
||||
};
|
||||
"diagnostic.warning" = {
|
||||
underline = {
|
||||
color = yellow;
|
||||
style = "curl";
|
||||
};
|
||||
};
|
||||
"diagnostic.error" = {
|
||||
underline = {
|
||||
color = red;
|
||||
style = "curl";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
155
modules/home/devtools/neovim/default.nix
Normal file
155
modules/home/devtools/neovim/default.nix
Normal file
@@ -0,0 +1,155 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.home.devtools.neovim;
|
||||
in {
|
||||
imports = [
|
||||
./plugins
|
||||
./lsp.nix
|
||||
./syntaxes.nix
|
||||
./keybindings.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
home.devtools.neovim.enable = mkEnableOption "Enable neovim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
extraLuaConfig =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
-- Use system clipboard
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
-- Colorscheme
|
||||
vim.cmd("colorscheme gruvbox-material")
|
||||
|
||||
-- Line Numbers and Cursorline
|
||||
vim.opt.number = true
|
||||
vim.opt.cursorline = true
|
||||
vim.wo.relativenumber = false
|
||||
|
||||
-- Nerd Font
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- Enable persistent undo
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = vim.fn.expand("~/.config/nvim/undo")
|
||||
|
||||
-- Set wildcharm to tab for triggering completion
|
||||
vim.opt.wildcharm = vim.fn.char2nr(vim.api.nvim_replace_termcodes("<Tab>", true, true, true))
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldmethod = "manual"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
-- vim.opt.foldexpr = "v:lua.vim.treesitter.foldtext()"
|
||||
|
||||
-- Tabs
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.softtabstop = 0
|
||||
vim.opt.shiftwidth = 0
|
||||
|
||||
-- 2 char-wide overrides for specific file types
|
||||
vim.api.nvim_create_augroup("two_space_tab", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "json", "html", "htmldjango", "hamlet", "nix", "scss", "typescript", "php", "haskell", "terraform" },
|
||||
command = "setlocal tabstop=2",
|
||||
group = "two_space_tab",
|
||||
})
|
||||
|
||||
-- Set tera to use htmldjango syntax
|
||||
vim.api.nvim_create_augroup("tera_htmldjango", { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
pattern = "*.tera",
|
||||
command = "setfiletype htmldjango",
|
||||
group = "tera_htmldjango",
|
||||
})
|
||||
|
||||
-- Options when composing mutt mail
|
||||
vim.api.nvim_create_augroup("mail_settings", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "mail",
|
||||
command = "set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions+=w",
|
||||
group = "mail_settings",
|
||||
})
|
||||
|
||||
-- Fix nvim size according to terminal
|
||||
vim.api.nvim_create_augroup("fix_size", { clear = true })
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
pattern = "*",
|
||||
command = "silent exec '!kill -s SIGWINCH' getpid()",
|
||||
group = "fix_size",
|
||||
})
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Diagnostic signs
|
||||
function add_sign(name, text)
|
||||
vim.fn.sign_define(name, { text = text, texthl = name, numhl = name })
|
||||
end
|
||||
|
||||
add_sign("DiagnosticSignError", " ")
|
||||
add_sign("DiagnosticSignWarn", " ")
|
||||
add_sign("DiagnosticSignHint", " ")
|
||||
add_sign("DiagnosticSignInfo", " ")
|
||||
|
||||
'';
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-table-mode
|
||||
editorconfig-nvim
|
||||
vim-surround
|
||||
gruvbox-material-nvim
|
||||
];
|
||||
};
|
||||
|
||||
xdg.desktopEntries = {
|
||||
nvim = {
|
||||
name = "Neovim";
|
||||
genericName = "Text Editor";
|
||||
comment = "Edit text files";
|
||||
exec = "nvim %F";
|
||||
icon = "nvim";
|
||||
mimeType = [
|
||||
"text/english"
|
||||
"text/plain"
|
||||
"text/x-makefile"
|
||||
"text/x-c++hdr"
|
||||
"text/x-c++src"
|
||||
"text/x-chdr"
|
||||
"text/x-csrc"
|
||||
"text/x-java"
|
||||
"text/x-moc"
|
||||
"text/x-pascal"
|
||||
"text/x-tcl"
|
||||
"text/x-tex"
|
||||
"application/x-shellscript"
|
||||
"text/x-c"
|
||||
"text/x-c++"
|
||||
];
|
||||
terminal = true;
|
||||
type = "Application";
|
||||
categories = [
|
||||
"Utility"
|
||||
"TextEditor"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
79
modules/home/devtools/neovim/keybindings.nix
Normal file
79
modules/home/devtools/neovim/keybindings.nix
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
config = {
|
||||
programs.neovim = {
|
||||
extraLuaConfig =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
-- Key mappings for various commands and navigation
|
||||
vim.api.nvim_set_keymap("n", "<C-j>", "<C-e>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-k>", "<C-y>", { noremap = true })
|
||||
|
||||
-- Buffers
|
||||
vim.api.nvim_set_keymap("n", "<space>b", ":buffers<CR>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-l>", ":bnext<CR>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-h>", ":bprev<CR>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-q>", ":bdel<CR>", { noremap = true })
|
||||
|
||||
-- Navigation
|
||||
vim.api.nvim_set_keymap("n", "<space>e", ":e<space>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<space>E", ":e %:h<tab>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<space>c", ":cd<space>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<space>C", ":cd %:h<tab>", { noremap = true })
|
||||
|
||||
-- Loclist
|
||||
vim.api.nvim_set_keymap("n", "<space>l", ":lwindow<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "[l", ":lprev<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "]l", ":lnext<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<space>L", ":lhistory<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "[L", ":lolder<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "]L", ":lnewer<cr>", { noremap = true })
|
||||
|
||||
-- Quickfix
|
||||
vim.api.nvim_set_keymap("n", "<space>q", ":cwindow<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "[q", ":cprev<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "]q", ":cnext<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<space>Q", ":chistory<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "[Q", ":colder<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "]Q", ":cnewer<cr>", { noremap = true })
|
||||
|
||||
-- Make
|
||||
vim.api.nvim_set_keymap("n", "<space>m", ":make<cr>", { noremap = true })
|
||||
|
||||
-- Grep (replace with ripgrep)
|
||||
vim.api.nvim_set_keymap("n", "<space>g", ":grep<space>", { noremap = true })
|
||||
if vim.fn.executable("rg") == 1 then
|
||||
vim.opt.grepprg = "rg --vimgrep"
|
||||
vim.opt.grepformat = "%f:%l:%c:%m"
|
||||
end
|
||||
|
||||
-- Close other splits
|
||||
vim.api.nvim_set_keymap("n", "<space>o", ":only<cr>", { noremap = true })
|
||||
|
||||
-- Sudo save
|
||||
vim.api.nvim_set_keymap("c", "w!!", "w !sudo tee > /dev/null %", { noremap = true })
|
||||
|
||||
-- Other utility key mappings
|
||||
vim.keymap.set("n", "<C-a>", "ggVG", { desc = "Select all" })
|
||||
vim.keymap.set("n", "<C-v>", "p", { desc = "Paste" })
|
||||
vim.keymap.set("i", "<C-v>", "<esc>p", { desc = "Paste" })
|
||||
vim.keymap.set("v", "<C-c>", "y", { desc = "Yank" })
|
||||
|
||||
-- LSP-related mappings
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" })
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
|
||||
vim.keymap.set("n", "<space>a", vim.lsp.buf.code_action, { desc = "Code action" })
|
||||
|
||||
-- Diagnostics
|
||||
vim.keymap.set("n", "<space>d", vim.diagnostic.open_float, { desc = "Floating diagnostic" })
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
|
||||
vim.keymap.set("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics on loclist" })
|
||||
vim.keymap.set("n", "gq", vim.diagnostic.setqflist, { desc = "Diagnostics on quickfix" })
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
133
modules/home/devtools/neovim/lsp.nix
Normal file
133
modules/home/devtools/neovim/lsp.nix
Normal file
@@ -0,0 +1,133 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
# LSP and completions for injected langs
|
||||
otter-nvim
|
||||
phpactor
|
||||
# LSP
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
function add_lsp(server, options)
|
||||
if not options["cmd"] then
|
||||
options["cmd"] = server["document_config"]["default_config"]["cmd"]
|
||||
end
|
||||
if not options["capabilities"] then
|
||||
options["capabilities"] = require("cmp_nvim_lsp").default_capabilities()
|
||||
end
|
||||
|
||||
if vim.fn.executable(options["cmd"][1]) == 1 then
|
||||
server.setup(options)
|
||||
end
|
||||
end
|
||||
|
||||
-- Other LSPs
|
||||
add_lsp(lspconfig.bashls, {})
|
||||
add_lsp(lspconfig.clangd, {})
|
||||
add_lsp(lspconfig.dartls, {})
|
||||
add_lsp(lspconfig.dockerls, {})
|
||||
add_lsp(lspconfig.gopls, {})
|
||||
add_lsp(lspconfig.hls, {})
|
||||
add_lsp(lspconfig.jdtls, {})
|
||||
add_lsp(lspconfig.kotlin_language_server, {})
|
||||
add_lsp(lspconfig.phpactor, { init_options = { ["language_server_php_cs_fixer.enabled"] = true } })
|
||||
add_lsp(lspconfig.rust_analyzer, {})
|
||||
add_lsp(lspconfig.nixd, {})
|
||||
add_lsp(lspconfig.lua_ls, {})
|
||||
add_lsp(lspconfig.pylsp, {})
|
||||
add_lsp(lspconfig.solargraph, {})
|
||||
add_lsp(lspconfig.terraformls, {})
|
||||
add_lsp(lspconfig.texlab, { chktex = {
|
||||
onEdit = true,
|
||||
onOpenAndSave = true,
|
||||
} })
|
||||
add_lsp(lspconfig.ts_ls, {})
|
||||
add_lsp(lspconfig.typst_lsp, {})
|
||||
add_lsp(lspconfig.elixirls, { cmd = { "elixir-ls" } })
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = ltex_extra-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
local ltex_extra = require("ltex_extra")
|
||||
add_lsp(lspconfig.ltex, {
|
||||
on_attach = function(client, bufnr)
|
||||
ltex_extra.setup({
|
||||
path = vim.fn.expand("~") .. "/.local/state/ltex",
|
||||
})
|
||||
end,
|
||||
})
|
||||
'';
|
||||
}
|
||||
|
||||
# Snippets
|
||||
luasnip
|
||||
|
||||
# Completions
|
||||
cmp-nvim-lsp
|
||||
cmp_luasnip
|
||||
cmp-rg
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
{
|
||||
plugin = cmp-git;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("cmp_git").setup({})
|
||||
'';
|
||||
}
|
||||
|
||||
lspkind-nvim
|
||||
{
|
||||
plugin = nvim-cmp;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({
|
||||
before = function(entry, vim_item)
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({}),
|
||||
sources = {
|
||||
{ name = "otter" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "git" },
|
||||
{ name = "buffer", option = { get_bufnrs = vim.api.nvim_list_bufs } },
|
||||
{ name = "path" },
|
||||
{ name = "rg" },
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
38
modules/home/devtools/neovim/plugins/alpha.nix
Normal file
38
modules/home/devtools/neovim/plugins/alpha.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = alpha-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
||||
" ",
|
||||
}
|
||||
dashboard.section.header.opts.hl = "Title"
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " New file", ":enew<CR>"),
|
||||
dashboard.button("e", " Explore", ":Explore<CR>"),
|
||||
dashboard.button("g", " Git summary", ":Git | :only<CR>"),
|
||||
dashboard.button("c", " Nix config flake", ":e ~/.nix-config/flake.nix<CR>"),
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
||||
vim.keymap.set("n", "<space>h", ":Alpha<CR>", { desc = "Open home dashboard" })
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/autopairs.nix
Normal file
15
modules/home/devtools/neovim/plugins/autopairs.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = nvim-autopairs;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("nvim-autopairs").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/bqf.nix
Normal file
15
modules/home/devtools/neovim/plugins/bqf.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = nvim-bqf;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("bqf").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/bufferline.nix
Normal file
15
modules/home/devtools/neovim/plugins/bufferline.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = bufferline-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("bufferline").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/colorizer.nix
Normal file
15
modules/home/devtools/neovim/plugins/colorizer.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = nvim-colorizer-lua;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("colorizer").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
22
modules/home/devtools/neovim/plugins/comment.nix
Normal file
22
modules/home/devtools/neovim/plugins/comment.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = comment-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("Comment").setup({
|
||||
opleader = {
|
||||
line = "<C-b>",
|
||||
},
|
||||
toggler = {
|
||||
line = "<C-b>",
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
47
modules/home/devtools/neovim/plugins/conform.nix
Normal file
47
modules/home/devtools/neovim/plugins/conform.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = conform-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("conform").setup({
|
||||
default_format_opts = {
|
||||
timeout_ms = 3000,
|
||||
async = false, -- not recommended to change
|
||||
quiet = false, -- not recommended to change
|
||||
lsp_format = "fallback", -- not recommended to change
|
||||
},
|
||||
formatters_by_ft = {
|
||||
bash = { "shfmt" },
|
||||
css = { "prettierd" },
|
||||
html = { "prettierd" },
|
||||
javascript = { "prettierd" },
|
||||
json = { "fixjson" },
|
||||
lua = { "stylua" },
|
||||
nix = { "alejandra" },
|
||||
php = { "php_cs_fixer" },
|
||||
python = { "black" },
|
||||
rust = { "rustfmt" },
|
||||
sh = { "shfmt" },
|
||||
typescript = { "prettierd" },
|
||||
query = { "sql_formatter" },
|
||||
yaml = { "prettierd" },
|
||||
["*"] = { "injected" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Optionally, set up a command or auto-command to format on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
require("conform").format()
|
||||
end,
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
45
modules/home/devtools/neovim/plugins/copilot.nix
Normal file
45
modules/home/devtools/neovim/plugins/copilot.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = copilot-lua;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("copilot").setup({
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = true,
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
open = "<M-CR>",
|
||||
},
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right
|
||||
ratio = 0.4,
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
hide_during_completion = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-CR>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
24
modules/home/devtools/neovim/plugins/default.nix
Normal file
24
modules/home/devtools/neovim/plugins/default.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
vim-illuminate
|
||||
];
|
||||
imports = [
|
||||
./alpha.nix
|
||||
./bufferline.nix
|
||||
./copilot.nix
|
||||
./fidget.nix
|
||||
./gitsigns.nix
|
||||
./treesitter.nix
|
||||
./conform.nix
|
||||
./gx.nix
|
||||
./bqf.nix
|
||||
./colorizer.nix
|
||||
./web-devicons.nix
|
||||
./oil.nix
|
||||
./lualine.nix
|
||||
./range-highlight.nix
|
||||
./fugitive.nix
|
||||
./which-key.nix
|
||||
./autopairs.nix
|
||||
];
|
||||
}
|
||||
21
modules/home/devtools/neovim/plugins/fidget.nix
Normal file
21
modules/home/devtools/neovim/plugins/fidget.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = fidget-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("fidget").setup({
|
||||
progress = {
|
||||
display = {
|
||||
progress_icon = { pattern = "dots", period = 1 },
|
||||
},
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/fugitive.nix
Normal file
15
modules/home/devtools/neovim/plugins/fugitive.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = vim-fugitive;
|
||||
type = "viml";
|
||||
config =
|
||||
/*
|
||||
vim
|
||||
*/
|
||||
''
|
||||
nmap <space>G :Git<CR>
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
23
modules/home/devtools/neovim/plugins/gitsigns.nix
Normal file
23
modules/home/devtools/neovim/plugins/gitsigns.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = gitsigns-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
28
modules/home/devtools/neovim/plugins/gx.nix
Normal file
28
modules/home/devtools/neovim/plugins/gx.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{pkgs, ...}: let
|
||||
gx-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "gx-nvim";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "chrishrb";
|
||||
repo = "gx.nvim";
|
||||
rev = "f29a87454b02880e0d76264c21be8316224a7395";
|
||||
hash = "sha256-QWJ/cPvSyMTJoWLg51BNFf9+/9i7G+nzennpHP/eQ4g=";
|
||||
};
|
||||
};
|
||||
in {
|
||||
programs.neovim.plugins = [
|
||||
{
|
||||
plugin = gx-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("gx").setup({})
|
||||
vim.keymap.set({ "n", "x" }, "gx", ":Browse<CR>", {
|
||||
desc = "Open the file under cursor with system app",
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
54
modules/home/devtools/neovim/plugins/lualine.nix
Normal file
54
modules/home/devtools/neovim/plugins/lualine.nix
Normal file
@@ -0,0 +1,54 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = lualine-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "gruvbox-material",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
51
modules/home/devtools/neovim/plugins/none-ls.nix
Normal file
51
modules/home/devtools/neovim/plugins/none-ls.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim = {
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
none-ls-nvim
|
||||
plenary-nvim
|
||||
nvim-treesitter.withAllGrammars
|
||||
];
|
||||
extraConfig =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
-- Require necessary plugins
|
||||
require("plenary")
|
||||
require("nvim-treesitter.configs").setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
-- Setup null-ls with stylua and other formatters
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.alejandra,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.phpcsfixer,
|
||||
null_ls.builtins.formatting.pint,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.sql_formatter,
|
||||
null_ls.builtins.formatting.xmllint,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
},
|
||||
})
|
||||
|
||||
-- Function to format on save
|
||||
local function format_on_save()
|
||||
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({ async = true })]])
|
||||
end
|
||||
|
||||
-- Call the function to enable auto format on save
|
||||
format_on_save()
|
||||
'';
|
||||
};
|
||||
}
|
||||
35
modules/home/devtools/neovim/plugins/oil.nix
Normal file
35
modules/home/devtools/neovim/plugins/oil.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = oil-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("oil").setup({
|
||||
buf_options = {
|
||||
buflisted = true,
|
||||
bufhidden = "delete",
|
||||
},
|
||||
cleanup_delay_ms = false,
|
||||
use_default_keymaps = false,
|
||||
keymaps = {
|
||||
["<CR>"] = "actions.select",
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["gc"] = "actions.close",
|
||||
["gr"] = "actions.refresh",
|
||||
["gs"] = "actions.change_sort",
|
||||
["gx"] = "actions.open_external",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
["g\\"] = "actions.toggle_trash",
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/plenary.nix
Normal file
15
modules/home/devtools/neovim/plugins/plenary.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = plenary-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("plenary").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/range-highlight.nix
Normal file
15
modules/home/devtools/neovim/plugins/range-highlight.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = range-highlight-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("range-highlight").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
20
modules/home/devtools/neovim/plugins/treesitter.nix
Normal file
20
modules/home/devtools/neovim/plugins/treesitter.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = nvim-treesitter.withAllGrammars;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("nvim-treesitter.configs").setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/web-devicons.nix
Normal file
15
modules/home/devtools/neovim/plugins/web-devicons.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = nvim-web-devicons;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("nvim-web-devicons").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
15
modules/home/devtools/neovim/plugins/which-key.nix
Normal file
15
modules/home/devtools/neovim/plugins/which-key.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = which-key-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require("which-key").setup({})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
54
modules/home/devtools/neovim/syntaxes.nix
Normal file
54
modules/home/devtools/neovim/syntaxes.nix
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.neovim = {
|
||||
extraConfig =
|
||||
lib.mkAfter # vim
|
||||
|
||||
''
|
||||
function! SetCustomKeywords()
|
||||
syn match Todo /TODO/
|
||||
syn match Done /DONE/
|
||||
syn match Start /START/
|
||||
syn match End /END/
|
||||
endfunction
|
||||
|
||||
autocmd Syntax * call SetCustomKeywords()
|
||||
'';
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
rust-vim
|
||||
dart-vim-plugin
|
||||
plantuml-syntax
|
||||
vim-markdown
|
||||
vim-nix
|
||||
vim-toml
|
||||
kotlin-vim
|
||||
haskell-vim
|
||||
pgsql-vim
|
||||
vim-terraform
|
||||
vim-jsx-typescript
|
||||
vim-caddyfile
|
||||
|
||||
{
|
||||
plugin = vimtex;
|
||||
config = let
|
||||
viewMethod =
|
||||
if config.programs.zathura.enable
|
||||
then "zathura"
|
||||
else "general";
|
||||
in
|
||||
/*
|
||||
vim
|
||||
*/
|
||||
''
|
||||
let g:vimtex_view_method = '${viewMethod}'
|
||||
"Don't open automatically
|
||||
let g:vimtex_quickfix_mode = 0
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
31
modules/home/devtools/nixvim/autocmd.nix
Normal file
31
modules/home/devtools/nixvim/autocmd.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
programs.nixvim.autoCmd = [
|
||||
# Open help in a vertical split
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = "help";
|
||||
command = "wincmd L";
|
||||
}
|
||||
|
||||
# Enable spellcheck for some filetypes
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = [
|
||||
"tex"
|
||||
"latex"
|
||||
"markdown"
|
||||
];
|
||||
command = "setlocal spell spelllang=en,se";
|
||||
}
|
||||
{
|
||||
event = "TextYankPost";
|
||||
desc = "Highlight when yanking (copying) text";
|
||||
# group = "vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true })";
|
||||
callback = {
|
||||
__raw = "function()
|
||||
vim.highlight.on_yank()
|
||||
end";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
150
modules/home/devtools/nixvim/completion.nix
Normal file
150
modules/home/devtools/nixvim/completion.nix
Normal file
@@ -0,0 +1,150 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
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 = {
|
||||
experimental = {ghost_text = true;};
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{
|
||||
name = "buffer";
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
}
|
||||
{name = "nvim_lua";}
|
||||
{name = "path";}
|
||||
{name = "copilot";}
|
||||
];
|
||||
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-l>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-ä>" = "cmp.mapping.select_next_item()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<S-Tab>" = "cmp.mapping.close()";
|
||||
"<Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
if line:match("^%s*$") then
|
||||
fallback()
|
||||
elseif cmp.visible() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
"<Down>" =
|
||||
# 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
|
||||
'';
|
||||
"<Up>" =
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
58
modules/home/devtools/nixvim/default.nix
Normal file
58
modules/home/devtools/nixvim/default.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.home.devtools.nixvim;
|
||||
in {
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./plugins
|
||||
./autocmd.nix
|
||||
./keymap.nix
|
||||
./options.nix
|
||||
./todo.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
home.devtools.nixvim.enable = mkEnableOption "Enable nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
extraPlugins = with pkgs.vimPlugins; [gruvbox-material-nvim nvim-web-devicons];
|
||||
colorscheme = "gruvbox-material";
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
luaLoader.enable = true;
|
||||
plugins = {
|
||||
gitsigns.enable = true;
|
||||
statuscol.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions.names = false;
|
||||
};
|
||||
oil.enable = true;
|
||||
trim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
highlight = false;
|
||||
ft_blocklist = [
|
||||
"checkhealth"
|
||||
"floaterm"
|
||||
"lspinfo"
|
||||
"neo-tree"
|
||||
"TelescopePrompt"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
94
modules/home/devtools/nixvim/keymap.nix
Normal file
94
modules/home/devtools/nixvim/keymap.nix
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
maplocalleader = " ";
|
||||
};
|
||||
|
||||
keymaps = let
|
||||
normal =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "n";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
# "<C-c>" = "<cmd> %y+ <CR>";
|
||||
"<C-v>" = "p";
|
||||
"<C-a>" = "ggVG";
|
||||
"<Space>" = "<NOP>";
|
||||
|
||||
# Esc to clear search results
|
||||
"<esc>" = ":noh<CR>";
|
||||
|
||||
# fix Y behaviour
|
||||
Y = "y$";
|
||||
|
||||
# back and fourth between the two most recent files
|
||||
"<C-c>" = ":b#<CR>";
|
||||
|
||||
# close by Ctrl+x
|
||||
"<C-x>" = ":close<CR>";
|
||||
|
||||
# save by Space+s or Ctrl+s
|
||||
"<leader>s" = ":w<CR>";
|
||||
"<C-s>" = ":w<CR>";
|
||||
|
||||
# navigate to left/right window
|
||||
"<leader>h" = "<C-w>h";
|
||||
"<leader>l" = "<C-w>l";
|
||||
|
||||
# Press 'H', 'L' to jump to start/end of a line (first/last character)
|
||||
L = "$";
|
||||
H = "^";
|
||||
|
||||
# resize with arrows
|
||||
"<C-Up>" = ":resize -2<CR>";
|
||||
"<C-Down>" = ":resize +2<CR>";
|
||||
"<C-Left>" = ":vertical resize +2<CR>";
|
||||
"<C-Right>" = ":vertical resize -2<CR>";
|
||||
|
||||
# move current line up/down
|
||||
# M = Alt key
|
||||
"<M-k>" = ":move-2<CR>";
|
||||
"<M-j>" = ":move+<CR>";
|
||||
|
||||
"<leader>rp" = ":!remi push<CR>";
|
||||
};
|
||||
visual =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "v";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
"<C-c>" = "y";
|
||||
# better indenting
|
||||
">" = ">gv";
|
||||
"<" = "<gv";
|
||||
"<TAB>" = ">gv";
|
||||
"<S-TAB>" = "<gv";
|
||||
|
||||
# move selected line / block of text in visual mode
|
||||
"K" = ":m '<-2<CR>gv=gv";
|
||||
"J" = ":m '>+1<CR>gv=gv";
|
||||
};
|
||||
insert =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "i";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
"<C-v>" = "<esc>p";
|
||||
};
|
||||
in
|
||||
config.lib.nixvim.keymaps.mkKeymaps
|
||||
{options.silent = true;}
|
||||
(normal ++ visual ++ insert);
|
||||
};
|
||||
}
|
||||
72
modules/home/devtools/nixvim/options.nix
Normal file
72
modules/home/devtools/nixvim/options.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
# Disable useless providers
|
||||
loaded_ruby_provider = 0; # Ruby
|
||||
loaded_perl_provider = 0; # Perl
|
||||
loaded_python_provider = 0; # Python 2
|
||||
};
|
||||
|
||||
clipboard = {
|
||||
# Use system clipboard
|
||||
register = "unnamedplus";
|
||||
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
|
||||
opts = {
|
||||
updatetime = 100; # Faster completion
|
||||
|
||||
# Line numbers
|
||||
relativenumber = false; # Relative line numbers
|
||||
number = true; # Display the absolute line number of the current line
|
||||
hidden = true; # Keep closed buffer open in the background
|
||||
showmode = false;
|
||||
mouse = "a"; # Enable mouse control
|
||||
mousemodel = "popup"; # Mouse right-click extends the current selection
|
||||
splitbelow = true; # A new window is put below the current one
|
||||
splitright = true; # A new window is put right of the current one
|
||||
list = true;
|
||||
listchars = {
|
||||
tab = "▷ ";
|
||||
trail = "·";
|
||||
nbsp = "○";
|
||||
extends = "◣";
|
||||
precedes = "◢";
|
||||
};
|
||||
|
||||
swapfile = false; # Disable the swap file
|
||||
modeline = true; # Tags such as 'vim:ft=sh'
|
||||
modelines = 100; # Sets the type of modelines
|
||||
undofile = true; # Automatically save and restore undo history
|
||||
incsearch = true; # Incremental search: show match for partly typed search command
|
||||
inccommand = "split"; # Search and replace: preview changes in quickfix list
|
||||
ignorecase = true; # When the search query is lower-case, match both lower and upper-case
|
||||
# patterns
|
||||
smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper
|
||||
# case characters
|
||||
scrolloff = 4; # Number of screen lines to show around the cursor
|
||||
cursorline = true; # Highlight the screen line of the cursor
|
||||
cursorcolumn = false; # Highlight the screen column of the cursor
|
||||
signcolumn = "yes"; # Whether to show the signcolumn
|
||||
colorcolumn = ""; # Columns to highlight
|
||||
laststatus = 3; # When to use a status line for the last window
|
||||
fileencoding = "utf-8"; # File-content encoding for the current buffer
|
||||
# termguicolors = true; # Enables 24-bit RGB color in the |TUI|
|
||||
spell = false; # Highlight spelling mistakes (local to window)
|
||||
wrap = false; # Prevent text from wrapping
|
||||
|
||||
# Tab options
|
||||
tabstop = 4; # Number of spaces a <Tab> in the text stands for (local to buffer)
|
||||
shiftwidth = 4; # Number of spaces used for each step of (auto)indent (local to buffer)
|
||||
expandtab = true; # Expand <Tab> to spaces in Insert mode (local to buffer)
|
||||
autoindent = true; # Do clever autoindenting
|
||||
|
||||
textwidth = 0; # Maximum width of text that is being inserted. A longer line will be
|
||||
# broken after white space to get this width.
|
||||
|
||||
# Folding
|
||||
foldlevel = 99; # Folds with a level higher than this number will be closed
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/home/devtools/nixvim/plugins/barbar.nix
Normal file
23
modules/home/devtools/nixvim/plugins/barbar.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.barbar;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.barbar.enable = mkEnableOption "Enables Barbar plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.barbar = {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
next.key = "<TAB>";
|
||||
previous.key = "<S-TAB>";
|
||||
close.key = "<C-w>";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
163
modules/home/devtools/nixvim/plugins/cmp.nix
Normal file
163
modules/home/devtools/nixvim/plugins/cmp.nix
Normal file
@@ -0,0 +1,163 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.cmp;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.cmp.enable = mkEnableOption "Enables completion plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
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 = {
|
||||
experimental = {ghost_text = true;};
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{
|
||||
name = "buffer";
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
}
|
||||
{name = "nvim_lua";}
|
||||
{name = "path";}
|
||||
{name = "copilot";}
|
||||
];
|
||||
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-l>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-ä>" = "cmp.mapping.select_next_item()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<S-Tab>" = "cmp.mapping.close()";
|
||||
"<Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
if line:match("^%s*$") then
|
||||
fallback()
|
||||
elseif cmp.visible() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
"<Down>" =
|
||||
# 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
|
||||
'';
|
||||
"<Up>" =
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/home/devtools/nixvim/plugins/comment.nix
Normal file
23
modules/home/devtools/nixvim/plugins/comment.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.comment;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.comment.enable = mkEnableOption "Enables Comment plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.comment = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
opleader.line = "<C-b>";
|
||||
toggler.line = "<C-b>";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
44
modules/home/devtools/nixvim/plugins/conform.nix
Normal file
44
modules/home/devtools/nixvim/plugins/conform.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.conform;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.conform.enable = mkEnableOption "Enables Conform plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.conform = {
|
||||
enable = true;
|
||||
settings = {
|
||||
notify_on_error = true;
|
||||
formatters_by_ft = {
|
||||
html = ["prettierd" "prettier"];
|
||||
css = ["prettierd" "prettier"];
|
||||
javascript = ["prettierd" "prettier"];
|
||||
javascriptreact = ["prettierd" "prettier"];
|
||||
typescript = ["prettierd" "prettier"];
|
||||
typescriptreact = ["prettierd" "prettier"];
|
||||
python = ["black"];
|
||||
lua = ["stylua"];
|
||||
nix = ["alejandra"];
|
||||
markdown = ["prettierd" "prettier"];
|
||||
yaml = ["yamlfmt"];
|
||||
rust = ["rustfmt"];
|
||||
xml = ["xmllint"];
|
||||
php = ["php-cs-fixer"];
|
||||
};
|
||||
stop_after_first = true;
|
||||
};
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
prettierd
|
||||
yamlfmt
|
||||
libxml2Python
|
||||
];
|
||||
};
|
||||
}
|
||||
53
modules/home/devtools/nixvim/plugins/copilot.nix
Normal file
53
modules/home/devtools/nixvim/plugins/copilot.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.copilot;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.copilot.enable = mkEnableOption "Enables AI tools for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
copilot-chat = {
|
||||
enable = true;
|
||||
};
|
||||
copilot-lua = {
|
||||
enable = true;
|
||||
suggestion = {
|
||||
enabled = false;
|
||||
autoTrigger = true;
|
||||
keymap.accept = "<C-CR>";
|
||||
};
|
||||
panel.enabled = false;
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>lua local input = vim.fn.input('Quick Chat: '); if input ~= '' then require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) end<CR>";
|
||||
key = "<leader>qc";
|
||||
options = {
|
||||
desc = "CopilotChat - Quick chat";
|
||||
};
|
||||
mode = [
|
||||
"n"
|
||||
];
|
||||
}
|
||||
{
|
||||
action = "<cmd>CopilotChatToggle<CR>";
|
||||
key = "<leader>ac";
|
||||
options = {
|
||||
desc = "Toggle Coilot chat";
|
||||
};
|
||||
mode = [
|
||||
"n"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
25
modules/home/devtools/nixvim/plugins/default.nix
Normal file
25
modules/home/devtools/nixvim/plugins/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{umodPath, ...}: {
|
||||
imports = [
|
||||
"${umodPath}/devtools/nixvim/plugins/barbar.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/comment.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/conform.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/cmp.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/copilot.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/efm.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/floaterm.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/harpoon.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/lsp.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/lualine.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/lightline.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/markdown-preview.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/neo-tree.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/nonels.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/rustaceanvim.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/startify.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/tagbar.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/telescope.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/treesitter.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/vimtex.nix"
|
||||
"${umodPath}/devtools/nixvim/plugins/yanky.nix"
|
||||
];
|
||||
}
|
||||
112
modules/home/devtools/nixvim/plugins/efm.nix
Normal file
112
modules/home/devtools/nixvim/plugins/efm.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.efm;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.efm.enable = mkEnableOption "Enables EFM LSP support for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins = {
|
||||
lsp.servers.efm = {
|
||||
enable = true;
|
||||
extraOptions.init_options = {
|
||||
documentFormatting = true;
|
||||
documentRangeFormatting = true;
|
||||
hover = true;
|
||||
documentSymbol = true;
|
||||
codeAction = true;
|
||||
completion = true;
|
||||
};
|
||||
};
|
||||
|
||||
lsp-format = {
|
||||
enable = true;
|
||||
lspServersToEnable = ["efm"];
|
||||
};
|
||||
|
||||
efmls-configs = {
|
||||
enable = true;
|
||||
|
||||
toolPackages.mdformat = pkgs.mdformat.withPlugins (
|
||||
ps:
|
||||
with ps; [
|
||||
# TODO: broken with update of mdformat
|
||||
# mdformat-gfm
|
||||
mdformat-frontmatter
|
||||
mdformat-footnote
|
||||
mdformat-tables
|
||||
mdit-py-plugins
|
||||
]
|
||||
);
|
||||
|
||||
setup = {
|
||||
sh = {
|
||||
#linter = "shellcheck";
|
||||
formatter = "shfmt";
|
||||
};
|
||||
bash = {
|
||||
#linter = "shellcheck";
|
||||
formatter = "shfmt";
|
||||
};
|
||||
c = {
|
||||
linter = "cppcheck";
|
||||
};
|
||||
markdown = {
|
||||
formatter = [
|
||||
"cbfmt"
|
||||
"mdformat"
|
||||
];
|
||||
};
|
||||
python = {
|
||||
formatter = "black";
|
||||
};
|
||||
nix = {
|
||||
formatter = "alejandra";
|
||||
linter = "statix";
|
||||
};
|
||||
lua = {
|
||||
formatter = "stylua";
|
||||
};
|
||||
html = {
|
||||
formatter = [
|
||||
"prettier"
|
||||
];
|
||||
};
|
||||
htmldjango = {
|
||||
linter = "djlint";
|
||||
};
|
||||
json = {
|
||||
formatter = "prettier";
|
||||
};
|
||||
css = {
|
||||
formatter = "prettier";
|
||||
};
|
||||
scss = {
|
||||
formatter = "prettier";
|
||||
};
|
||||
ts = {
|
||||
formatter = "prettier";
|
||||
};
|
||||
gitcommit = {
|
||||
linter = "gitlint";
|
||||
};
|
||||
php = {
|
||||
formatter = "php_cs_fixer";
|
||||
};
|
||||
rust = {
|
||||
formatter = "rustfmt";
|
||||
};
|
||||
sql = {
|
||||
formatter = "sql-formatter";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/home/devtools/nixvim/plugins/floaterm.nix
Normal file
23
modules/home/devtools/nixvim/plugins/floaterm.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.floaterm;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.floaterm.enable = mkEnableOption "Enables Floaterm plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.floaterm = {
|
||||
enable = true;
|
||||
width = 0.8;
|
||||
height = 0.8;
|
||||
title = "";
|
||||
|
||||
keymaps.toggle = "<leader>,";
|
||||
};
|
||||
};
|
||||
}
|
||||
31
modules/home/devtools/nixvim/plugins/harpoon.nix
Normal file
31
modules/home/devtools/nixvim/plugins/harpoon.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.harpoon;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.harpoon.enable = mkEnableOption "Enables Harpoon plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.harpoon = {
|
||||
enable = true;
|
||||
|
||||
keymapsSilent = true;
|
||||
|
||||
keymaps = {
|
||||
addFile = "<leader>a";
|
||||
toggleQuickMenu = "<C-e>";
|
||||
navFile = {
|
||||
"1" = "<C-j>";
|
||||
"2" = "<C-k>";
|
||||
"3" = "<C-l>";
|
||||
"4" = "<C-m>";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
51
modules/home/devtools/nixvim/plugins/lightline.nix
Normal file
51
modules/home/devtools/nixvim/plugins/lightline.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.lightline;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.lightline.enable = mkEnableOption "Enables lightline plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.lightline = {
|
||||
enable = true;
|
||||
settings = {
|
||||
colorscheme = "apprentice";
|
||||
active = {
|
||||
right = [
|
||||
[
|
||||
"lineinfo"
|
||||
]
|
||||
[
|
||||
"percent"
|
||||
]
|
||||
[
|
||||
"fileformat"
|
||||
"fileencoding"
|
||||
"filetype"
|
||||
]
|
||||
];
|
||||
};
|
||||
component = {
|
||||
charvaluehex = "0x%B";
|
||||
lineinfo = "%3l:%-2v%<";
|
||||
};
|
||||
component_function = {
|
||||
gitbranch = "FugitiveHead";
|
||||
};
|
||||
inactive = [];
|
||||
mode_map = {
|
||||
"<C-s>" = "SB";
|
||||
"<C-v>" = "VB";
|
||||
i = "I";
|
||||
n = "N";
|
||||
v = "V";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
32
modules/home/devtools/nixvim/plugins/lsp-format.nix
Normal file
32
modules/home/devtools/nixvim/plugins/lsp-format.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.lsp-format;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.lsp-format = {
|
||||
enable = mkEnableOption "Enables LSP formatting support for nixvim";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.lsp-format = {
|
||||
enable = true;
|
||||
|
||||
lspServersToEnable = [
|
||||
"rustfmt"
|
||||
"prettier"
|
||||
"prettierd"
|
||||
"php-cs-fixer"
|
||||
"alejandra"
|
||||
"xmllint"
|
||||
"black"
|
||||
"yamlfmt"
|
||||
"stylua"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
76
modules/home/devtools/nixvim/plugins/lsp.nix
Normal file
76
modules/home/devtools/nixvim/plugins/lsp.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.lsp;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.lsp = {
|
||||
enable = mkEnableOption "Enables LSP support for nixvim";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins = {
|
||||
lsp-format = {
|
||||
enable = true;
|
||||
lspServersToEnable = [
|
||||
"rust-analyzer"
|
||||
];
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
silent = true;
|
||||
diagnostic = {
|
||||
"<leader>k" = "goto_prev";
|
||||
"<leader>j" = "goto_next";
|
||||
};
|
||||
|
||||
lspBuf = {
|
||||
gd = "definition";
|
||||
gD = "references";
|
||||
gt = "type_definition";
|
||||
gi = "implementation";
|
||||
K = "hover";
|
||||
"<F2>" = "rename";
|
||||
};
|
||||
};
|
||||
|
||||
servers = {
|
||||
# Average webdev LSPs
|
||||
cssls.enable = true; # CSS
|
||||
tailwindcss.enable = true; # TailwindCSS
|
||||
html.enable = true; # HTML
|
||||
astro.enable = true; # AstroJS
|
||||
phpactor.enable = true; # PHP
|
||||
svelte.enable = false; # Svelte
|
||||
vuels.enable = false; # Vue
|
||||
pyright.enable = true;
|
||||
marksman.enable = true;
|
||||
nixd.enable = true;
|
||||
dockerls.enable = true;
|
||||
bashls.enable = true;
|
||||
clangd.enable = true;
|
||||
csharp-ls.enable = true;
|
||||
yamlls.enable = true;
|
||||
lua-ls = {
|
||||
enable = true;
|
||||
settings = {
|
||||
telemetry.enable = false;
|
||||
diagnostics = {
|
||||
globals = ["vim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
tsserver = {
|
||||
enable = false; # TS/JS
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
69
modules/home/devtools/nixvim/plugins/lualine.nix
Normal file
69
modules/home/devtools/nixvim/plugins/lualine.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.lualine;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.lualine.enable = mkEnableOption "Enables Lualine plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.lualine = {
|
||||
enable = true;
|
||||
theme = "gruvbox-material";
|
||||
globalstatus = true;
|
||||
|
||||
sections = {
|
||||
lualine_a = ["mode"];
|
||||
lualine_b = ["branch"];
|
||||
lualine_c = ["filename" "diff"];
|
||||
|
||||
lualine_x = [
|
||||
"diagnostics"
|
||||
|
||||
# Show active language server
|
||||
{
|
||||
name.__raw = ''
|
||||
function()
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
local non_null_ls_clients = {}
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
if client.name ~= "null-ls" then
|
||||
table.insert(non_null_ls_clients, client)
|
||||
end
|
||||
end
|
||||
|
||||
if #non_null_ls_clients > 0 then
|
||||
for _, client in ipairs(non_null_ls_clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
else
|
||||
for _, client in ipairs(clients) do
|
||||
if client.name == "null-ls" then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return msg
|
||||
end
|
||||
'';
|
||||
icon = "";
|
||||
color.fg = "#A89984";
|
||||
}
|
||||
"fileformat"
|
||||
"filetype"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
modules/home/devtools/nixvim/plugins/markdown-preview.nix
Normal file
33
modules/home/devtools/nixvim/plugins/markdown-preview.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.markdown-preview;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.markdown-preview.enable = mkEnableOption "Enables Markdown Preview plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins.markdown-preview = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
auto_close = false;
|
||||
theme = "dark";
|
||||
};
|
||||
};
|
||||
|
||||
files."after/ftplugin/markdown.lua".keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>m";
|
||||
action = ":MarkdownPreview<cr>";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
35
modules/home/devtools/nixvim/plugins/neo-tree.nix
Normal file
35
modules/home/devtools/nixvim/plugins/neo-tree.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.neo-tree;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.neo-tree.enable = mkEnableOption "Enables neo-tree plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
|
||||
closeIfLastWindow = true;
|
||||
window = {
|
||||
width = 30;
|
||||
# autoExpandWidth = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>n";
|
||||
action = ":Neotree focus toggle<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
60
modules/home/devtools/nixvim/plugins/nonels.nix
Normal file
60
modules/home/devtools/nixvim/plugins/nonels.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.none-ls;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.none-ls.enable = mkEnableOption "Enables None-LS plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.none-ls = {
|
||||
enable = true;
|
||||
settings = {
|
||||
cmd = ["bash -c nvim"];
|
||||
debug = true;
|
||||
};
|
||||
sources = {
|
||||
code_actions = {
|
||||
statix.enable = true;
|
||||
gitsigns.enable = true;
|
||||
};
|
||||
diagnostics = {
|
||||
statix.enable = true;
|
||||
deadnix.enable = true;
|
||||
pylint.enable = true;
|
||||
checkstyle.enable = true;
|
||||
};
|
||||
formatting = {
|
||||
alejandra.enable = true;
|
||||
stylua.enable = true;
|
||||
shfmt.enable = true;
|
||||
google_java_format.enable = false;
|
||||
prettier = {
|
||||
enable = true;
|
||||
disableTsServerFormatter = true;
|
||||
};
|
||||
prettierd.enable = true;
|
||||
phpcsfixer.enable = true;
|
||||
xmllint.enable = true;
|
||||
yamlfmt.enable = true;
|
||||
black = {
|
||||
enable = true;
|
||||
settings = ''
|
||||
{
|
||||
extra_args = { "--fast" };
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
completion = {
|
||||
luasnip.enable = true;
|
||||
spell.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
29
modules/home/devtools/nixvim/plugins/rustaceanvim.nix
Normal file
29
modules/home/devtools/nixvim/plugins/rustaceanvim.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.devtools.nixvim.plugins.rustaceanvim;
|
||||
in {
|
||||
options.home.devtools.nixvim.plugins.rustaceanvim = {
|
||||
enable = mkEnableOption "Whether to enable rustaceanvim.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins.rustaceanvim = {
|
||||
enable = true;
|
||||
|
||||
settings.server = {
|
||||
default_settings.rust-analyzer = {
|
||||
cargo.features = "all";
|
||||
checkOnSave = true;
|
||||
check.command = "clippy";
|
||||
rustc.source = "discover";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
36
modules/home/devtools/nixvim/plugins/startify.nix
Normal file
36
modules/home/devtools/nixvim/plugins/startify.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.startify;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.startify.enable = mkEnableOption "Enables Startify plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.startify = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
custom_header = [
|
||||
""
|
||||
" ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
" ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
" ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
" ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
" ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
" ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
|
||||
change_to_dir = false;
|
||||
use_unicode = true;
|
||||
lists = [{type = "dir";}];
|
||||
files_number = 30;
|
||||
skiplist = ["flake.lock"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
30
modules/home/devtools/nixvim/plugins/tagbar.nix
Normal file
30
modules/home/devtools/nixvim/plugins/tagbar.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.tagbar;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.tagbar.enable = mkEnableOption "Enables Tagbar plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins.tagbar = {
|
||||
enable = true;
|
||||
settings.width = 50;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-g>";
|
||||
action = ":TagbarToggle<cr>";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
42
modules/home/devtools/nixvim/plugins/telescope.nix
Normal file
42
modules/home/devtools/nixvim/plugins/telescope.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.telescope;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.telescope.enable = mkEnableOption "Enables Telescope plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
"<leader>ff" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>fh" = "help_tags";
|
||||
"<leader>fd" = "diagnostics";
|
||||
|
||||
"<C-p>" = "git_files";
|
||||
"<leader>p" = "oldfiles";
|
||||
"<C-f>" = "live_grep";
|
||||
};
|
||||
|
||||
settings.defaults = {
|
||||
file_ignore_patterns = [
|
||||
"^.git/"
|
||||
"^.mypy_cache/"
|
||||
"^__pycache__/"
|
||||
"^output/"
|
||||
"^data/"
|
||||
"%.ipynb"
|
||||
];
|
||||
set_env.COLORTERM = "truecolor";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
40
modules/home/devtools/nixvim/plugins/treesitter.nix
Normal file
40
modules/home/devtools/nixvim/plugins/treesitter.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.treesitter;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins = {
|
||||
treesitter.enable = mkEnableOption "Enables Treesitter plugin for nixvim";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
nixvimInjections = true;
|
||||
settings = {
|
||||
highlight.enable = true;
|
||||
indent.enable = true;
|
||||
};
|
||||
folding = true;
|
||||
};
|
||||
|
||||
treesitter-refactor = mkIf cfg.enable {
|
||||
enable = true;
|
||||
highlightDefinitions = {
|
||||
enable = true;
|
||||
clearOnCursorMove = false;
|
||||
};
|
||||
};
|
||||
|
||||
hmts = mkIf cfg.enable {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
78
modules/home/devtools/nixvim/plugins/vimtex.nix
Normal file
78
modules/home/devtools/nixvim/plugins/vimtex.nix
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.vimtex;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.vimtex.enable = mkEnableOption "Enables VimTeX plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
plugins.vimtex = {
|
||||
enable = true;
|
||||
settings = {
|
||||
view_method = "zathura";
|
||||
quickfix_enabled = true;
|
||||
quickfix_open_on_warning = false;
|
||||
quickfix_ignore_filters = [
|
||||
"Underfull"
|
||||
"Overfull"
|
||||
"specifier changed to"
|
||||
"Token not allowed in a PDF string"
|
||||
];
|
||||
toc_config = {
|
||||
name = "TOC";
|
||||
layers = ["content" "todo"];
|
||||
resize = true;
|
||||
split_width = 50;
|
||||
todo_sorted = false;
|
||||
show_help = true;
|
||||
show_numbers = true;
|
||||
mode = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
files."after/ftplugin/tex.lua".keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "m";
|
||||
action = ":VimtexView<cr>";
|
||||
}
|
||||
];
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
event = ["BufEnter" "BufWinEnter"];
|
||||
pattern = "*.tex";
|
||||
command = "set filetype=tex \"| VimtexTocOpen";
|
||||
}
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = ["tex" "latex"];
|
||||
callback = ''
|
||||
function ()
|
||||
vim.o.foldmethod = 'expr'
|
||||
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
|
||||
vim.o.foldtext = 'vimtex#fold#text()'
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
event = "User";
|
||||
pattern = "VimtexEventInitPost";
|
||||
callback = "vimtex#compiler#compile";
|
||||
}
|
||||
{
|
||||
event = "User";
|
||||
pattern = "VimtexEventQuit";
|
||||
command = "call vimtex#compiler#clean(0)";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/home/devtools/nixvim/plugins/yanky.nix
Normal file
18
modules/home/devtools/nixvim/plugins/yanky.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.home.devtools.nixvim.plugins.yanky;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.nixvim.plugins.yanky.enable = mkEnableOption "Enables Yanky plugin for nixvim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim.plugins.yanky = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
26
modules/home/devtools/nixvim/todo.nix
Normal file
26
modules/home/devtools/nixvim/todo.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
highlight.Todo = {
|
||||
fg = "Blue";
|
||||
bg = "Yellow";
|
||||
};
|
||||
|
||||
match.TODO = "TODO";
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-t>";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
default_text="TODO",
|
||||
initial_mode="normal"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
17
modules/home/devtools/vscode/default.nix
Normal file
17
modules/home/devtools/vscode/default.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.home.devtools.vscode;
|
||||
in {
|
||||
options = {
|
||||
home.devtools.vscode.enable = mkEnableOption "Enables vscode";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user