286 lines
6.8 KiB
Nix
286 lines
6.8 KiB
Nix
{ inputs, pkgs, ... }: {
|
|
imports = [ inputs.nixvim.homeManagerModules.nixvim ];
|
|
|
|
# Nixvim
|
|
programs.nixvim = {
|
|
enable = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
|
|
keymaps = [
|
|
{
|
|
action = "<cmd>Oil<cr>";
|
|
key = "<leader>e";
|
|
options = { silent = true; };
|
|
}
|
|
{
|
|
action =
|
|
"<cmd>lua require('conform').format({ bufnr = buf, lsp_fallback = true })<cr>";
|
|
key = "<leader>f";
|
|
options = { silent = true; };
|
|
}
|
|
];
|
|
|
|
options = {
|
|
hlsearch = false;
|
|
incsearch = true;
|
|
number = true;
|
|
relativenumber = true;
|
|
tabstop = 4;
|
|
softtabstop = 4;
|
|
shiftwidth = 4;
|
|
expandtab = true;
|
|
smartindent = true;
|
|
mouse = "";
|
|
breakindent = true;
|
|
undofile = true;
|
|
swapfile = true;
|
|
ignorecase = true;
|
|
smartcase = true;
|
|
signcolumn = "yes";
|
|
completeopt = "menuone,noselect";
|
|
updatetime = 50;
|
|
timeoutlen = 300;
|
|
colorcolumn = "80";
|
|
showmode = false;
|
|
laststatus = 3;
|
|
splitbelow = true;
|
|
splitright = true;
|
|
};
|
|
|
|
globals = {
|
|
mapleader = " ";
|
|
maplocalleader = ";";
|
|
};
|
|
|
|
extraConfigLuaPre = ''
|
|
vim.loader.enable()
|
|
'';
|
|
|
|
extraConfigLuaPost = ''
|
|
vim.notify = require("mini.notify").make_notify()
|
|
|
|
vim.opt.formatoptions:remove({'c', 'r', 'o'})
|
|
'';
|
|
extraPackages = with pkgs; [
|
|
stylua
|
|
isort
|
|
black
|
|
nixfmt
|
|
jq
|
|
shfmt
|
|
ripgrep
|
|
prettierd
|
|
];
|
|
plugins = {
|
|
comment-nvim.enable = true;
|
|
|
|
ts-context-commentstring.enable = true;
|
|
|
|
todo-comments.enable = true;
|
|
|
|
lspkind = {
|
|
enable = true;
|
|
cmp.enable = true;
|
|
};
|
|
|
|
indent-blankline = {
|
|
enable = true;
|
|
scope.enabled = false;
|
|
};
|
|
|
|
cmp = {
|
|
enable = true;
|
|
settings = {
|
|
mapping = {
|
|
"<C-l>" = "cmp.mapping.confirm({ select = true })";
|
|
"<C-j>" = ''
|
|
function(fallback)
|
|
if cmp.visible then
|
|
cmp.select_next_item()
|
|
else
|
|
fallback()
|
|
end
|
|
end
|
|
'';
|
|
"<C-k>" = ''
|
|
function(fallback)
|
|
if cmp.visible then
|
|
cmp.select_prev_item()
|
|
else
|
|
fallback()
|
|
end
|
|
end
|
|
'';
|
|
"<C-Space>" = "cmp.mapping.complete()";
|
|
"<C-e>" = "cmp.mapping.abort()";
|
|
"<C-u>" = "cmp.mapping.scroll_docs(-4)";
|
|
"<C-d>" = "cmp.mapping.scroll_docs(4)";
|
|
};
|
|
snippet.expand = ''
|
|
function(args)
|
|
require('snippy').expand_snippet(args.body)
|
|
end
|
|
'';
|
|
sources =
|
|
[ { name = "nvim_lsp"; } { name = "path"; } { name = "snippy"; } ];
|
|
};
|
|
};
|
|
conform-nvim = {
|
|
enable = true;
|
|
formattersByFt = {
|
|
json = [ "jq" ];
|
|
lua = [ "stylua" ];
|
|
python = [ "isort" "black" ];
|
|
nix = [ "nixfmt" ];
|
|
sh = [ "shfmt" ];
|
|
bash = [ "shfmt" ];
|
|
zsh = [ "zsh" ];
|
|
html = [ "prettierd" ];
|
|
css = [ "prettierd" ];
|
|
};
|
|
};
|
|
lint = {
|
|
enable = true;
|
|
lintersByFt = {
|
|
python = [ "mypy" ];
|
|
ruby = [ "ruby" ];
|
|
sh = [ "shellcheck" ];
|
|
bash = [ "shellcheck" ];
|
|
zsh = [ "shellcheck" ];
|
|
};
|
|
};
|
|
harpoon = {
|
|
enable = true;
|
|
keymaps = {
|
|
addFile = "<leader>a";
|
|
toggleQuickMenu = "<C-e>";
|
|
navFile = {
|
|
"1" = "<C-j>";
|
|
"2" = "<C-k>";
|
|
"3" = "<C-l>";
|
|
"4" = "<C-;>";
|
|
};
|
|
};
|
|
};
|
|
|
|
oil = {
|
|
enable = true;
|
|
defaultFileExplorer = true;
|
|
extraOptions = { show_hidden = true; };
|
|
};
|
|
|
|
treesitter.enable = true;
|
|
|
|
gitsigns = {
|
|
enable = true;
|
|
signs = {
|
|
add.text = "▎";
|
|
change.text = "▎";
|
|
changedelete.text = "▎";
|
|
delete.text = "▎";
|
|
topdelete.text = "▎";
|
|
untracked.text = "▎";
|
|
};
|
|
onAttach.function = ''
|
|
function(buffer)
|
|
local gs = package.loaded.gitsigns
|
|
|
|
local function map(mode, l, r, desc)
|
|
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
|
end
|
|
|
|
-- stylua: ignore start
|
|
map("n", "]g", gs.next_hunk, "Next git hunk")
|
|
map("n", "[g", gs.prev_hunk, "Previous git hunk")
|
|
end
|
|
'';
|
|
};
|
|
|
|
mini = {
|
|
enable = true;
|
|
modules = {
|
|
statusline = { set_vim_settings = false; };
|
|
notify = { };
|
|
};
|
|
};
|
|
|
|
telescope = {
|
|
enable = true;
|
|
extensions = {
|
|
fzf-native = {
|
|
enable = true;
|
|
fuzzy = true;
|
|
overrideGenericSorter = true;
|
|
overrideFileSorter = true;
|
|
caseMode = "smart_case";
|
|
};
|
|
ui-select.enable = true;
|
|
};
|
|
keymaps = {
|
|
"<leader>pf" = "find_files";
|
|
"<C-p>" = "git_files";
|
|
"<leader>vh" = "help_tags";
|
|
"<leader>ps" = "grep_string";
|
|
};
|
|
};
|
|
|
|
lsp = {
|
|
enable = true;
|
|
servers = {
|
|
lua-ls.enable = true;
|
|
nil_ls.enable = true;
|
|
marksman.enable = true;
|
|
gopls.enable = true;
|
|
pyright.enable = true;
|
|
html.enable = true;
|
|
emmet_ls.enable = true;
|
|
cssls.enable = true;
|
|
bashls.enable = true;
|
|
};
|
|
keymaps = {
|
|
diagnostic = {
|
|
"<leader>vd" = "open_float";
|
|
"[d" = "goto_next";
|
|
"]d" = "goto_prev";
|
|
};
|
|
lspBuf = {
|
|
K = "hover";
|
|
gd = "definition";
|
|
gD = "declaration";
|
|
gi = "implementation";
|
|
"<leader>lca" = "code_action";
|
|
"<leader>lrn" = "rename";
|
|
"<C-h>" = "signature_help";
|
|
};
|
|
};
|
|
|
|
preConfig = ''
|
|
local function sign_define(args)
|
|
vim.fn.sign_define(args.name, {
|
|
texthl = args.name,
|
|
text = args.text,
|
|
numhl = "",
|
|
})
|
|
end
|
|
|
|
sign_define({ name = "DiagnosticSignError", text = "E" })
|
|
sign_define({ name = "DiagnosticSignWarn", text = "W" })
|
|
sign_define({ name = "DiagnosticSignHint", text = "H" })
|
|
sign_define({ name = "DiagnosticSignInfo", text = "I" })
|
|
'';
|
|
};
|
|
};
|
|
|
|
colorschemes.catppuccin = {
|
|
enable = true;
|
|
flavour = "frappe";
|
|
styles = {
|
|
functions = [ "bold" ];
|
|
keywords = [ "bold" ];
|
|
};
|
|
};
|
|
extraPlugins = with pkgs.vimPlugins; [ vim-snippets ];
|
|
};
|
|
}
|