197 lines
5.0 KiB
Nix
197 lines
5.0 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
inputs,
|
|
...
|
|
}: let
|
|
program = "nvf";
|
|
cfg = config.dots.${program};
|
|
#sec = sops.secrets;
|
|
in {
|
|
options.dots.${program} = {
|
|
enable = lib.mkEnableOption "enables ${program}";
|
|
};
|
|
|
|
imports = [
|
|
inputs.nvf.homeManagerModules.default
|
|
];
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
programs.${program} = {
|
|
enable = true;
|
|
settings = {
|
|
vim = {
|
|
globals = {
|
|
mapleader = " ";
|
|
maplocalleader = " ";
|
|
};
|
|
|
|
vimAlias = true;
|
|
|
|
lsp.enable = true;
|
|
statusline.lualine.enable = true;
|
|
telescope.enable = true;
|
|
autocomplete.nvim-cmp.enable = true;
|
|
autopairs.nvim-autopairs.enable = true;
|
|
|
|
keymaps = [
|
|
# visual line movement (insert mode)
|
|
{
|
|
key = "<Up>";
|
|
mode = ["i"];
|
|
action = "<C-o>gk";
|
|
desc = "Visual Line Up (Insert)";
|
|
}
|
|
{
|
|
key = "<Down>";
|
|
mode = ["i"];
|
|
action = "<C-o>gj";
|
|
desc = "Visual Line Down (Insert)";
|
|
}
|
|
|
|
# visual line movement (normal/visual)
|
|
{
|
|
key = "<Up>";
|
|
mode = [
|
|
"n"
|
|
"v"
|
|
];
|
|
action = "g<Up>";
|
|
desc = "Visual Line Up";
|
|
}
|
|
{
|
|
key = "<Down>";
|
|
mode = [
|
|
"n"
|
|
"v"
|
|
];
|
|
action = "g<Down>";
|
|
desc = "Visual Line Down";
|
|
}
|
|
|
|
# lsp
|
|
#{ key = "gd"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.definition()<CR>"; desc = "Go to definition"; }
|
|
#{ key = "K"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.hover()<CR>"; desc = "Hover info"; }
|
|
#{ key = "<leader>f"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>"; desc = "Format buffer"; }
|
|
|
|
{
|
|
key = "gd";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.lsp.buf.definition()<CR>";
|
|
desc = "Go to definition";
|
|
}
|
|
# Hover info
|
|
{
|
|
key = "K";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
|
|
desc = "Hover info";
|
|
}
|
|
# Format buffer (Alejandra for Nix)
|
|
{
|
|
key = "<leader>F";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>";
|
|
desc = "Format buffer";
|
|
}
|
|
# Code actions / quickfix
|
|
{
|
|
key = "<leader>a";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
|
desc = "Code action";
|
|
}
|
|
# Rename symbol
|
|
{
|
|
key = "<leader>r";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
|
|
desc = "Rename symbol";
|
|
}
|
|
# Diagnostics
|
|
{
|
|
key = "<leader>e";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
|
desc = "Show diagnostic";
|
|
}
|
|
{
|
|
key = "[d";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
|
|
desc = "Previous diagnostic";
|
|
}
|
|
{
|
|
key = "]d";
|
|
mode = ["n"];
|
|
silent = true;
|
|
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
|
|
desc = "Next diagnostic";
|
|
}
|
|
];
|
|
|
|
options = {
|
|
clipboard = "unnamedplus";
|
|
|
|
# line numbers
|
|
number = true;
|
|
numberwidth = 2;
|
|
relativenumber = true;
|
|
|
|
# tabs and indentation
|
|
tabstop = 2;
|
|
shiftwidth = 2;
|
|
softtabstop = -1;
|
|
expandtab = true;
|
|
smarttab = true;
|
|
autoindent = true;
|
|
|
|
# search
|
|
ignorecase = true;
|
|
smartcase = true;
|
|
|
|
# files and backups
|
|
backup = false;
|
|
writebackup = false;
|
|
undofile = true;
|
|
swapfile = true;
|
|
|
|
# wrapping
|
|
wrap = true;
|
|
linebreak = true;
|
|
breakindent = true;
|
|
|
|
termguicolors = true;
|
|
autoread = true;
|
|
};
|
|
|
|
languages = {
|
|
enableTreesitter = true;
|
|
|
|
nix = {
|
|
enable = true;
|
|
format = {
|
|
enable = true;
|
|
type = "alejandra";
|
|
#type = "nixfmt";
|
|
};
|
|
};
|
|
|
|
markdown.enable = true;
|
|
rust.enable = true;
|
|
lua.enable = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|