mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
from nixvim to nvf
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> Former-commit-id: 0d6390b18f38bdba346a1f92799884d209159b33
This commit is contained in:
25
home/programs/nvf/default.nix
Normal file
25
home/programs/nvf/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.nvf.homeManagerModules.default
|
||||
./options.nix
|
||||
./languages.nix
|
||||
./picker.nix
|
||||
./snacks.nix
|
||||
./keymaps.nix
|
||||
./utils.nix
|
||||
./mini.nix
|
||||
];
|
||||
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
settings.vim = {
|
||||
startPlugins = [
|
||||
pkgs.vimPlugins.vim-kitty-navigator
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
173
home/programs/nvf/keymaps.nix
Normal file
173
home/programs/nvf/keymaps.nix
Normal file
@@ -0,0 +1,173 @@
|
||||
{
|
||||
programs.nvf.settings.vim = {
|
||||
globals.mapleader = " ";
|
||||
binds = {
|
||||
whichKey = {
|
||||
enable = true;
|
||||
# TODO: registers
|
||||
register = {};
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
# General Mappings
|
||||
{
|
||||
key = "s";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua require('flash').jump()<cr>";
|
||||
desc = "Flash";
|
||||
}
|
||||
{
|
||||
key = "K";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua vim.lsp.buf.hover()<cr>";
|
||||
desc = "LSP Hover";
|
||||
}
|
||||
{
|
||||
key = "<C-tab>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>bnext<cr>";
|
||||
desc = "Next Buffer";
|
||||
}
|
||||
|
||||
# Kitty navigator
|
||||
{
|
||||
key = "<C-h>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>KittyNavigateLeft<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-j>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>KittyNavigateDown<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-k>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>KittyNavigateUp<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-l>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>KittyNavigateRight<cr>";
|
||||
}
|
||||
|
||||
# Disable Arrow Keys in Normal Mode
|
||||
{
|
||||
key = "<Up>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<Nop>";
|
||||
desc = "Disable Up Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Down>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<Nop>";
|
||||
desc = "Disable Down Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Left>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<Nop>";
|
||||
desc = "Disable Left Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Right>";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<Nop>";
|
||||
desc = "Disable Right Arrow";
|
||||
}
|
||||
|
||||
# UI
|
||||
{
|
||||
key = "<leader>uw";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set wrap!<cr>";
|
||||
desc = "Toggle word wrapping";
|
||||
}
|
||||
{
|
||||
key = "<leader>ul";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set linebreak!<cr>";
|
||||
desc = "Toggle linebreak";
|
||||
}
|
||||
{
|
||||
key = "<leader>us";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set spell!<cr>";
|
||||
desc = "Toggle spellLazyGitcheck";
|
||||
}
|
||||
{
|
||||
key = "<leader>uc";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set cursorline!<cr>";
|
||||
desc = "Toggle cursorline";
|
||||
}
|
||||
{
|
||||
key = "<leader>un";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set number!<cr>";
|
||||
desc = "Toggle line numbers";
|
||||
}
|
||||
{
|
||||
key = "<leader>ur";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set relativenumber!<cr>";
|
||||
desc = "Toggle relative line numbers";
|
||||
}
|
||||
{
|
||||
key = "<leader>ut";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set showtabline=2<cr>";
|
||||
desc = "Show tabline";
|
||||
}
|
||||
{
|
||||
key = "<leader>uT";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>set showtabline=0<cr>";
|
||||
desc = "Hide tabline";
|
||||
}
|
||||
|
||||
# Windows
|
||||
{
|
||||
key = "<leader>ws";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>split<cr>";
|
||||
desc = "Split";
|
||||
}
|
||||
{
|
||||
key = "<leader>wv";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>vsplit<cr>";
|
||||
desc = "VSplit";
|
||||
}
|
||||
{
|
||||
key = "<leader>wd";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>close<cr>";
|
||||
desc = "Close";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
46
home/programs/nvf/languages.nix
Normal file
46
home/programs/nvf/languages.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
programs.nvf.settings.vim = {
|
||||
diagnostics = {
|
||||
enable = true;
|
||||
nvim-lint.enable = true;
|
||||
config.virtual_text = true;
|
||||
};
|
||||
syntaxHighlighting = true;
|
||||
treesitter = {
|
||||
enable = true;
|
||||
autotagHtml = true;
|
||||
context.enable = true;
|
||||
highlight = {
|
||||
enable = true;
|
||||
additionalVimRegexHighlighting = true;
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
trouble.enable = true;
|
||||
formatOnSave = true;
|
||||
inlayHints.enable = true;
|
||||
lightbulb.enable = true;
|
||||
null-ls.enable = true;
|
||||
otter-nvim.enable = true;
|
||||
};
|
||||
languages = {
|
||||
enableDAP = true;
|
||||
enableExtraDiagnostics = true;
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
|
||||
astro.enable = true;
|
||||
go.enable = true;
|
||||
markdown.enable = true;
|
||||
ts.enable = true;
|
||||
ts.extensions.ts-error-translator.enable = true;
|
||||
css.enable = true;
|
||||
svelte.enable = true;
|
||||
html.enable = true;
|
||||
bash.enable = true;
|
||||
nix.enable = true;
|
||||
tailwind.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
13
home/programs/nvf/mini.nix
Normal file
13
home/programs/nvf/mini.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
programs.nvf.settings.vim.mini = {
|
||||
starter.enable = true;
|
||||
comment.enable = true;
|
||||
# cursorword.enable = true;
|
||||
icons.enable = true;
|
||||
indentscope.enable = true;
|
||||
notify.enable = true;
|
||||
pairs.enable = true;
|
||||
diff.enable = true;
|
||||
git.enable = true;
|
||||
};
|
||||
}
|
||||
21
home/programs/nvf/options.nix
Normal file
21
home/programs/nvf/options.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
programs.nvf.settings.vim = {
|
||||
viAlias = false;
|
||||
vimAlias = true;
|
||||
withNodeJs = true;
|
||||
# syntaxHighlighting = true;
|
||||
options = {
|
||||
autoindent = true;
|
||||
shiftwidth = 2;
|
||||
signcolumn = "yes";
|
||||
tabstop = 2;
|
||||
softtabstop = 2;
|
||||
wrap = false;
|
||||
};
|
||||
clipboard = {
|
||||
enable = true;
|
||||
registers = "unnamedplus";
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,221 +1,256 @@
|
||||
{ config, ... }: {
|
||||
programs.nixvim = {
|
||||
highlightOverride = {
|
||||
SnacksPicker = {
|
||||
bg = "none";
|
||||
nocombine = true;
|
||||
{
|
||||
programs.nvf.settings.vim = {
|
||||
utility = {
|
||||
oil-nvim.enable = true;
|
||||
snacks-nvim = {
|
||||
setupOpts = {
|
||||
picker.enabled = true;
|
||||
explorer.enabled = true;
|
||||
};
|
||||
};
|
||||
SnacksPickerBorder = {
|
||||
bg = "none";
|
||||
fg = "#${config.lib.stylix.colors.base0D}";
|
||||
};
|
||||
SnacksPickerTree = { bg = "#${config.lib.stylix.colors.base00}"; };
|
||||
FloatBorder = {
|
||||
bg = "#${config.lib.stylix.colors.base00}";
|
||||
fg = "#${config.lib.stylix.colors.base0D}";
|
||||
};
|
||||
NormalFloat = { bg = "#${config.lib.stylix.colors.base00}"; };
|
||||
};
|
||||
plugins = {
|
||||
snacks.settings = {
|
||||
picker.enable = true;
|
||||
explorer.enable = true;
|
||||
};
|
||||
oil.enable = true;
|
||||
which-key.settings.spec = [
|
||||
{
|
||||
__unkeyed-1 = "<leader>f";
|
||||
mode = "n";
|
||||
group = "+find";
|
||||
}
|
||||
{
|
||||
__unkeyed-1 = "<leader>g";
|
||||
mode = "n";
|
||||
group = "+git";
|
||||
}
|
||||
{
|
||||
__unkeyed-1 = "<leader>s";
|
||||
mode = "n";
|
||||
group = "+search";
|
||||
}
|
||||
];
|
||||
};
|
||||
keymaps = [
|
||||
# Top Pickers & Explorer
|
||||
{
|
||||
key = "<leader> ";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.smart()<cr>";
|
||||
options.desc = "Smart Find Files";
|
||||
desc = "Smart Find Files";
|
||||
}
|
||||
{
|
||||
key = "<leader>,";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.buffers()<cr>";
|
||||
options.desc = "Buffers";
|
||||
desc = "Buffers";
|
||||
}
|
||||
{
|
||||
key = "<leader>/";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.grep()<cr>";
|
||||
options.desc = "Grep";
|
||||
desc = "Grep";
|
||||
}
|
||||
{
|
||||
key = "<leader>:";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.command_history()<cr>";
|
||||
options.desc = "Command History";
|
||||
desc = "Command History";
|
||||
}
|
||||
{
|
||||
key = "<leader>e";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.explorer()<cr>";
|
||||
options.desc = "File Explorer";
|
||||
desc = "File Explorer";
|
||||
}
|
||||
{
|
||||
key = "-";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>Oil<cr>";
|
||||
options.desc = "Oil";
|
||||
desc = "Oil";
|
||||
}
|
||||
|
||||
# Find
|
||||
{
|
||||
key = "<leader>fb";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.buffers()<cr>";
|
||||
options.desc = "Buffers";
|
||||
desc = "Buffers";
|
||||
}
|
||||
{
|
||||
key = "<leader>fc";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = ''
|
||||
<cmd>lua Snacks.picker.files({ cwd = vim.fn.stdpath("config") })<cr>'';
|
||||
options.desc = "Find Config File";
|
||||
desc = "Find Config File";
|
||||
}
|
||||
{
|
||||
key = "<leader>ff";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.files()<cr>";
|
||||
options.desc = "Find Files";
|
||||
desc = "Find Files";
|
||||
}
|
||||
{
|
||||
key = "<leader>fg";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_files()<cr>";
|
||||
options.desc = "Find Git Files";
|
||||
desc = "Find Git Files";
|
||||
}
|
||||
{
|
||||
key = "<leader>fp";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.projects()<cr>";
|
||||
options.desc = "Projects";
|
||||
desc = "Projects";
|
||||
}
|
||||
{
|
||||
key = "<leader>fr";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.recent()<cr>";
|
||||
options.desc = "Recent";
|
||||
desc = "Recent";
|
||||
}
|
||||
{
|
||||
key = "<leader>fn";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.notifications()<cr>";
|
||||
options.desc = "Notification History";
|
||||
desc = "Notification History";
|
||||
}
|
||||
{
|
||||
key = "<leader>fe";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.icons()<cr>";
|
||||
options.desc = "Emoji";
|
||||
desc = "Emoji";
|
||||
}
|
||||
|
||||
# Git
|
||||
{
|
||||
key = "<leader>gb";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_branches()<cr>";
|
||||
options.desc = "Git Branches";
|
||||
desc = "Git Branches";
|
||||
}
|
||||
{
|
||||
key = "<leader>gL";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_log()<cr>";
|
||||
options.desc = "Git Log Line";
|
||||
desc = "Git Log Line";
|
||||
}
|
||||
{
|
||||
key = "<leader>gs";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_status()<cr>";
|
||||
options.desc = "Git Status";
|
||||
desc = "Git Status";
|
||||
}
|
||||
{
|
||||
key = "<leader>gS";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_stash()<cr>";
|
||||
options.desc = "Git Stash";
|
||||
desc = "Git Stash";
|
||||
}
|
||||
{
|
||||
key = "<leader>gd";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_diff()<cr>";
|
||||
options.desc = "Git Diff (Hunks)";
|
||||
desc = "Git Diff (Hunks)";
|
||||
}
|
||||
{
|
||||
key = "<leader>gf";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.git_log_file()<cr>";
|
||||
options.desc = "Git Log File";
|
||||
desc = "Git Log File";
|
||||
}
|
||||
|
||||
# Grep
|
||||
{
|
||||
key = "<leader>sb";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lines()<cr>";
|
||||
options.desc = "Buffer Lines";
|
||||
desc = "Buffer Lines";
|
||||
}
|
||||
{
|
||||
key = "<leader>st";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.todo_comments()<cr>";
|
||||
options.desc = "Todos";
|
||||
desc = "Todos";
|
||||
}
|
||||
{
|
||||
key = "<leader>sB";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.grep_buffers()<cr>";
|
||||
options.desc = "Grep Open Buffers";
|
||||
desc = "Grep Open Buffers";
|
||||
}
|
||||
{
|
||||
key = "<leader>sg";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.grep()<cr>";
|
||||
options.desc = "Grep";
|
||||
desc = "Grep";
|
||||
}
|
||||
{
|
||||
key = "<leader>sw";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.grep_word()<cr>";
|
||||
options.desc = "Visual selection or word";
|
||||
desc = "Visual selection or word";
|
||||
}
|
||||
{
|
||||
key = "<leader>sr";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>nohlsearch<cr>";
|
||||
options.desc = "Reset search";
|
||||
desc = "Reset search";
|
||||
}
|
||||
|
||||
# LSP
|
||||
{
|
||||
key = "gd";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_definitions()<cr>";
|
||||
options.desc = "Goto Definition";
|
||||
desc = "Goto Definition";
|
||||
}
|
||||
{
|
||||
key = "gD";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_declarations()<cr>";
|
||||
options.desc = "Goto Declaration";
|
||||
desc = "Goto Declaration";
|
||||
}
|
||||
{
|
||||
key = "gr";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_references()<cr>";
|
||||
options.desc = "References";
|
||||
options.nowait = true;
|
||||
desc = "References";
|
||||
nowait = true;
|
||||
}
|
||||
{
|
||||
key = "gI";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_implementations()<cr>";
|
||||
options.desc = "Goto Implementation";
|
||||
desc = "Goto Implementation";
|
||||
}
|
||||
{
|
||||
key = "gy";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_type_definitions()<cr>";
|
||||
options.desc = "Goto Type Definition";
|
||||
desc = "Goto Type Definition";
|
||||
}
|
||||
{
|
||||
key = "<leader>ss";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_symbols()<cr>";
|
||||
options.desc = "LSP Symbols";
|
||||
desc = "LSP Symbols";
|
||||
}
|
||||
{
|
||||
key = "<leader>sS";
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>lua Snacks.picker.lsp_workspace_symbols()<cr>";
|
||||
options.desc = "LSP Workspace Symbols";
|
||||
desc = "LSP Workspace Symbols";
|
||||
}
|
||||
];
|
||||
};
|
||||
16
home/programs/nvf/snacks.nix
Normal file
16
home/programs/nvf/snacks.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
programs.nvf.settings.vim.utility.snacks-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
image = {
|
||||
enabled = true;
|
||||
setupOpts.doc.inline = false;
|
||||
};
|
||||
quickfile.enabled = true;
|
||||
statuscolumn.enabled = true;
|
||||
zen.enabled = true;
|
||||
bufdelete.enabled = true;
|
||||
gitsigns.enabled = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
33
home/programs/nvf/utils.nix
Normal file
33
home/programs/nvf/utils.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
programs.nvf.settings.vim = {
|
||||
utility = {
|
||||
motion.flash-nvim.enable = true;
|
||||
outline.aerial-nvim.enable = true;
|
||||
};
|
||||
tabline.nvimBufferline.enable = true;
|
||||
notes.todo-comments.enable = true;
|
||||
assistant.copilot = {
|
||||
enable = true;
|
||||
cmp.enable = true;
|
||||
};
|
||||
statusline.lualine.enable = true;
|
||||
autocomplete.blink-cmp = {
|
||||
enable = true;
|
||||
friendly-snippets.enable = true;
|
||||
};
|
||||
snippets.luasnip.enable = true;
|
||||
ui = {
|
||||
noice.enable = true;
|
||||
colorizer.enable = true;
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
gitsigns.enable = true;
|
||||
};
|
||||
terminal.toggleterm = {
|
||||
enable = true;
|
||||
lazygit.enable = true;
|
||||
};
|
||||
formatter.conform-nvim.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
autoGroups = {
|
||||
highlightyank.clear = true;
|
||||
q_close_windows.clear = true;
|
||||
};
|
||||
|
||||
autoCmd = [
|
||||
# highlightyank
|
||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L206-L211
|
||||
{
|
||||
desc = "Highlight yanked text";
|
||||
event = "TextYankPost";
|
||||
group = "highlightyank";
|
||||
pattern = "*";
|
||||
|
||||
callback.__raw = ''
|
||||
function()
|
||||
vim.highlight.on_yank()
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
||||
# q_close_windows
|
||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L242-L255
|
||||
{
|
||||
desc = "Make q close help, man, quickfix, dap floats";
|
||||
event = "BufWinEnter";
|
||||
group = "q_close_windows";
|
||||
|
||||
callback.__raw = ''
|
||||
function(event)
|
||||
if vim.tbl_contains({ "help", "nofile", "quickfix" }, vim.bo[event.buf].buftype) then
|
||||
vim.keymap.set("n", "q", "<Cmd>close<CR>", {
|
||||
desc = "Close window",
|
||||
buffer = event.buf,
|
||||
silent = true,
|
||||
nowait = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
# Nixvim is a NixOS module that installs and configures Neovim
|
||||
{ inputs, ... }: {
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./plugins/cmp.nix
|
||||
./plugins/floaterm.nix
|
||||
./plugins/git.nix
|
||||
./plugins/lsp.nix
|
||||
./plugins/markdown.nix
|
||||
./plugins/mini.nix
|
||||
./plugins/picker.nix
|
||||
./plugins/snacks.nix
|
||||
./plugins/trouble.nix
|
||||
./plugins/utils.nix
|
||||
|
||||
./options.nix
|
||||
./keymaps.nix
|
||||
./autocmds.nix
|
||||
];
|
||||
|
||||
programs.nixvim.enable = true;
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.which-key = {
|
||||
enable = true;
|
||||
settings = {
|
||||
delay = 600;
|
||||
icons = {
|
||||
breadcrumb = "»";
|
||||
group = "+";
|
||||
separator = ""; # ➜
|
||||
mappings = false;
|
||||
};
|
||||
spec = [
|
||||
# General Mappings
|
||||
{
|
||||
__unkeyed-1 = "<leader>u";
|
||||
mode = "n";
|
||||
group = "+ui";
|
||||
}
|
||||
{
|
||||
__unkeyed-1 = "<leader>w";
|
||||
mode = "n";
|
||||
group = "+windows";
|
||||
}
|
||||
{
|
||||
__unkeyed-1 = "<leader>c";
|
||||
mode = "n";
|
||||
group = "+code";
|
||||
}
|
||||
];
|
||||
win = {
|
||||
border = "rounded";
|
||||
wo.winblend = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
# General Mappings
|
||||
{
|
||||
key = "s";
|
||||
action = "<cmd>lua require('flash').jump()<cr>";
|
||||
options.desc = "Flash";
|
||||
}
|
||||
{
|
||||
key = "K";
|
||||
action = "<cmd>lua vim.lsp.buf.hover()<cr>";
|
||||
options.desc = "LSP Hover";
|
||||
}
|
||||
{
|
||||
key = "<C-tab>";
|
||||
action = "<cmd>bnext<cr>";
|
||||
options.desc = "Next Buffer";
|
||||
}
|
||||
|
||||
# Tmux
|
||||
{
|
||||
key = "<C-h>";
|
||||
action = "<cmd>TmuxNavigateLeft<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-j>";
|
||||
action = "<cmd>TmuxNavigateDown<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-k>";
|
||||
action = "<cmd>TmuxNavigateUp<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-l>";
|
||||
action = "<cmd>TmuxNavigateRight<cr>";
|
||||
}
|
||||
|
||||
# Disable Arrow Keys in Normal Mode
|
||||
{
|
||||
key = "<Up>";
|
||||
action = "<Nop>";
|
||||
options.desc = "Disable Up Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Down>";
|
||||
action = "<Nop>";
|
||||
options.desc = "Disable Down Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Left>";
|
||||
action = "<Nop>";
|
||||
options.desc = "Disable Left Arrow";
|
||||
}
|
||||
{
|
||||
key = "<Right>";
|
||||
action = "<Nop>";
|
||||
options.desc = "Disable Right Arrow";
|
||||
}
|
||||
|
||||
# UI
|
||||
{
|
||||
key = "<leader>uw";
|
||||
action = "<cmd>set wrap!<cr>";
|
||||
options.desc = "Toggle word wrapping";
|
||||
}
|
||||
{
|
||||
key = "<leader>ul";
|
||||
action = "<cmd>set linebreak!<cr>";
|
||||
options.desc = "Toggle linebreak";
|
||||
}
|
||||
{
|
||||
key = "<leader>us";
|
||||
action = "<cmd>set spell!<cr>";
|
||||
options.desc = "Toggle spellLazyGitcheck";
|
||||
}
|
||||
{
|
||||
key = "<leader>uc";
|
||||
action = "<cmd>set cursorline!<cr>";
|
||||
options.desc = "Toggle cursorline";
|
||||
}
|
||||
{
|
||||
key = "<leader>un";
|
||||
action = "<cmd>set number!<cr>";
|
||||
options.desc = "Toggle line numbers";
|
||||
}
|
||||
{
|
||||
key = "<leader>ur";
|
||||
action = "<cmd>set relativenumber!<cr>";
|
||||
options.desc = "Toggle relative line numbers";
|
||||
}
|
||||
{
|
||||
key = "<leader>ut";
|
||||
action = "<cmd>set showtabline=2<cr>";
|
||||
options.desc = "Show tabline";
|
||||
}
|
||||
{
|
||||
key = "<leader>uT";
|
||||
action = "<cmd>set showtabline=0<cr>";
|
||||
options.desc = "Hide tabline";
|
||||
}
|
||||
|
||||
# Windows
|
||||
{
|
||||
key = "<leader>ws";
|
||||
action = "<cmd>split<cr>";
|
||||
options.desc = "Split";
|
||||
}
|
||||
{
|
||||
key = "<leader>wv";
|
||||
action = "<cmd>vsplit<cr>";
|
||||
options.desc = "VSplit";
|
||||
}
|
||||
{
|
||||
key = "<leader>wd";
|
||||
action = "<cmd>close<cr>";
|
||||
options.desc = "Close";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
globals.mapleader = " ";
|
||||
diagnostic.settings = {
|
||||
virtual_text = true;
|
||||
virtual_improved = { current_line = "only"; };
|
||||
};
|
||||
opts = {
|
||||
autoindent = true;
|
||||
|
||||
smartindent = true;
|
||||
|
||||
incsearch = true;
|
||||
hlsearch = true;
|
||||
wildmode = "list:longest";
|
||||
scrolloff = 8;
|
||||
|
||||
swapfile = false;
|
||||
conceallevel = 3;
|
||||
clipboard = "unnamed,unnamedplus";
|
||||
|
||||
# Don't stop backspace at insert
|
||||
backspace.__raw = ''
|
||||
vim.list_extend(vim.opt.backspace:get(), { "nostop" })
|
||||
'';
|
||||
|
||||
# Keep visual indentation on wrapped lines
|
||||
breakindent = true;
|
||||
|
||||
# Hide command line unless needed
|
||||
cmdheight = 0;
|
||||
|
||||
# Insert mode completion options
|
||||
completeopt = [ "menu" "menuone" "noselect" ];
|
||||
|
||||
# Raise a dialog asking if you wish to save the current file(s)
|
||||
confirm = true;
|
||||
|
||||
# Copy previous indentation on autoindenting
|
||||
copyindent = true;
|
||||
|
||||
# Highlight current line
|
||||
cursorline = true;
|
||||
|
||||
# Expand <Tab> to spaces
|
||||
expandtab = true;
|
||||
|
||||
# Disable `~` on nonexistent lines
|
||||
fillchars = { eob = " "; };
|
||||
|
||||
# Enable fold with all code unfolded
|
||||
foldcolumn = "1";
|
||||
foldenable = true;
|
||||
foldlevel = 99;
|
||||
foldlevelstart = 99;
|
||||
|
||||
# Ignore case in search patterns
|
||||
ignorecase = true;
|
||||
|
||||
# Show substitution preview in split window
|
||||
inccommand = "split";
|
||||
|
||||
# Infer casing on word completion
|
||||
infercase = true;
|
||||
|
||||
# Global statusline
|
||||
laststatus = 3;
|
||||
|
||||
# Wrap lines at 'breakat'
|
||||
linebreak = true;
|
||||
|
||||
# Enable mouse support
|
||||
mouse = "a";
|
||||
|
||||
# Show line numbers
|
||||
number = true;
|
||||
|
||||
# Preserve indentation as much as possible
|
||||
preserveindent = true;
|
||||
|
||||
# Height of the popup menu
|
||||
pumheight = 10;
|
||||
|
||||
# Display line numbers relative to current line
|
||||
relativenumber = true;
|
||||
|
||||
# Minimal number of lines to keep around the cursor
|
||||
# This has the effect to move the view along with current line
|
||||
#scrolloff = 999;
|
||||
|
||||
# Number of spaces to use for indentation
|
||||
shiftwidth = 2;
|
||||
|
||||
# Disable showing modes in command line
|
||||
showmode = false;
|
||||
|
||||
# Always show tabline
|
||||
showtabline = 2;
|
||||
|
||||
# Show signs column
|
||||
signcolumn = "yes";
|
||||
|
||||
# Override ignorecase if search pattern contains uppercase characters
|
||||
smartcase = true;
|
||||
|
||||
# Number of spaces input on <Tab>
|
||||
softtabstop = 2;
|
||||
|
||||
# Open horizontal split below (:split)
|
||||
splitbelow = true;
|
||||
|
||||
# Open vertical split to the right (:vsplit)
|
||||
splitright = true;
|
||||
|
||||
# Number of spaces to represent a <Tab>
|
||||
tabstop = 2;
|
||||
|
||||
# Enables 24-bit RGB color
|
||||
termguicolors = true;
|
||||
|
||||
# Shorter timeout duration
|
||||
timeoutlen = 500;
|
||||
|
||||
# Set window title to the filename
|
||||
title = true;
|
||||
|
||||
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
||||
undofile = true;
|
||||
|
||||
# Enable virtual edit in visual block mode
|
||||
# This has the effect of selecting empty cells beyond lines boundaries
|
||||
virtualedit = "block";
|
||||
|
||||
# Disable line wrapping
|
||||
wrap = false;
|
||||
|
||||
# Disable making a backup before overwriting a file
|
||||
writebackup = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
{
|
||||
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 = {
|
||||
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 = "mkdnflow"; }
|
||||
{ name = "render-markdown"; }
|
||||
{ name = "path"; }
|
||||
];
|
||||
|
||||
formatting = {
|
||||
fields = [ "abbr" "kind" "menu" ];
|
||||
format =
|
||||
# lua
|
||||
''
|
||||
function(_, item)
|
||||
local icons = {
|
||||
Namespace = "",
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
Table = "",
|
||||
Object = "",
|
||||
Tag = "",
|
||||
Array = "[]",
|
||||
Boolean = "",
|
||||
Number = "",
|
||||
Null = "",
|
||||
String = "",
|
||||
Calendar = "",
|
||||
Watch = "",
|
||||
Package = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
TabNine = "",
|
||||
}
|
||||
|
||||
local icon = icons[item.kind] or ""
|
||||
item.kind = string.format("%s %s", icon, item.kind or "")
|
||||
return item
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight =
|
||||
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
|
||||
scrollbar = false;
|
||||
sidePadding = 0;
|
||||
border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ];
|
||||
};
|
||||
|
||||
documentation = {
|
||||
border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ];
|
||||
winhighlight =
|
||||
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
|
||||
};
|
||||
};
|
||||
|
||||
mapping = {
|
||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||
"<Down>" = "cmp.mapping.select_next_item()";
|
||||
"<Up>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<CR>" =
|
||||
"cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{ config, ... }: {
|
||||
programs.nixvim = {
|
||||
plugins.floaterm.enable = true;
|
||||
highlightOverride = {
|
||||
FloatermBorder.fg = "#${config.lib.stylix.colors.base01}";
|
||||
};
|
||||
keymaps = [{
|
||||
key = "<leader>cn";
|
||||
action =
|
||||
"<cmd>FloatermNew --wintype=split --height=20 --title=nixy --autoclose=0 nixy<cr>";
|
||||
options.desc = "Nixy";
|
||||
}];
|
||||
};
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
gitsigns.enable = true;
|
||||
snacks.settings = { lazygit.enable = true; };
|
||||
};
|
||||
keymaps = [{
|
||||
key = "<leader>gl";
|
||||
action = "<cmd>lua Snacks.lazygit()<cr>";
|
||||
options.desc = "LazyGit";
|
||||
}];
|
||||
};
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
lsp-format.enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
inlayHints = true;
|
||||
servers = {
|
||||
bashls.enable = true;
|
||||
gopls.enable = true;
|
||||
ts_ls.enable = true;
|
||||
nixd.enable = true;
|
||||
tailwindcss.enable = true;
|
||||
html.enable = true;
|
||||
svelte.enable = true;
|
||||
astro.enable = true;
|
||||
};
|
||||
};
|
||||
none-ls = {
|
||||
enable = true;
|
||||
sources = {
|
||||
completion = { luasnip.enable = true; };
|
||||
diagnostics = {
|
||||
golangci_lint.enable = true;
|
||||
statix.enable = true;
|
||||
};
|
||||
formatting = {
|
||||
gofmt.enable = true;
|
||||
goimports.enable = true;
|
||||
nixfmt.enable = true;
|
||||
markdownlint.enable = true;
|
||||
tidy.enable = true;
|
||||
shellharden.enable = true;
|
||||
shfmt.enable = true;
|
||||
golines.enable = true;
|
||||
gofumpt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
accent = "#${config.lib.stylix.colors.base0D}";
|
||||
muted = "#${config.lib.stylix.colors.base03}";
|
||||
in {
|
||||
programs.nixvim = {
|
||||
extraFiles."after/ftplugin/markdown.lua".text = ''
|
||||
vim.bo.tabstop = 2
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
vim.wo.cursorline = false
|
||||
'';
|
||||
|
||||
# Plugins
|
||||
plugins = {
|
||||
# Render UI elements
|
||||
render-markdown = {
|
||||
enable = true;
|
||||
settings = { completions.lsp.enabled = true; };
|
||||
};
|
||||
|
||||
mkdnflow = {
|
||||
enable = true;
|
||||
mappings = {
|
||||
MkdnTableNextCell = {
|
||||
key = "<S-Tab>";
|
||||
modes = "i";
|
||||
};
|
||||
MkdnTablePrevCell = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{ config, ... }: {
|
||||
programs.nixvim = {
|
||||
plugins.mini = {
|
||||
enable = true;
|
||||
mockDevIcons = true;
|
||||
modules = {
|
||||
icons = { };
|
||||
# TODO: Learn how to use this
|
||||
bracketed = { };
|
||||
git = { };
|
||||
diff = { };
|
||||
starter = { };
|
||||
pairs = { };
|
||||
notify = { lsp_progress.enable = false; };
|
||||
indentscope = { };
|
||||
cursorword = { };
|
||||
comment = { };
|
||||
starter = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.snacks = {
|
||||
enable = true;
|
||||
settings = {
|
||||
image = {
|
||||
enable = true;
|
||||
doc = { inline = false; };
|
||||
};
|
||||
quickfile.enable = true;
|
||||
statuscolumn.enable = true;
|
||||
zen.enable = true;
|
||||
bufdelete.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>uz";
|
||||
action = "<cmd>lua Snacks.zen()<cr>";
|
||||
options.desc = "Zen";
|
||||
}
|
||||
{
|
||||
key = "<leader>ud";
|
||||
action = "<cmd>lua Snacks.dim.enable()<cr>";
|
||||
options.desc = "Dim";
|
||||
}
|
||||
{
|
||||
key = "<leader>uD";
|
||||
action = "<cmd>lua Snacks.dim.disable()<cr>";
|
||||
options.desc = "Undim";
|
||||
}
|
||||
{
|
||||
key = "<leader>wc";
|
||||
action = "<cmd>lua Snacks.bufdelete.all()<cr>";
|
||||
options.desc = "Close all buffers";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
{ pkgs, ... }: {
|
||||
home.packages = with pkgs; [ ctags ];
|
||||
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
trouble.enable = true;
|
||||
which-key.settings.spec = [{
|
||||
__unkeyed-1 = "<leader>t";
|
||||
mode = "n";
|
||||
group = "+trouble";
|
||||
}];
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>tx";
|
||||
action = "<cmd>Trouble diagnostics toggle<cr>";
|
||||
options.desc = "Diagnostics (Trouble)";
|
||||
}
|
||||
{
|
||||
key = "<leader>tX";
|
||||
action = "<cmd>Trouble diagnostics toggle filter.buf=0<cr>";
|
||||
options.desc = "Buffer Diagnostics (Trouble)";
|
||||
}
|
||||
{
|
||||
key = "<leader>ts";
|
||||
action = "<cmd>Trouble symbols toggle focus=false<cr>";
|
||||
options.desc = "Symbols (Trouble)";
|
||||
}
|
||||
{
|
||||
key = "<leader>tl";
|
||||
action = "<cmd>Trouble lsp toggle focus=false win.position=right<cr>";
|
||||
options.desc = "LSP Definitions / references / ... (Trouble)";
|
||||
}
|
||||
{
|
||||
key = "<leader>tL";
|
||||
action = "<cmd>Trouble loclist toggle<cr>";
|
||||
options.desc = "Location List (Trouble)";
|
||||
}
|
||||
{
|
||||
key = "<leader>tQ";
|
||||
action = "<cmd>Trouble qflist toggle<cr>";
|
||||
options.desc = "Quickfix List (Trouble)";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
programs.nixvim = {
|
||||
nixpkgs.config.allowUnfree = true; # For copilot
|
||||
highlightOverride = {
|
||||
WhichKeySeparator.bg = "#${config.lib.stylix.colors.base00}";
|
||||
};
|
||||
plugins = {
|
||||
bufferline.enable = true;
|
||||
copilot-vim = {
|
||||
enable = true;
|
||||
settings.node_command = lib.getExe pkgs.nodejs_20;
|
||||
};
|
||||
flash.enable = true;
|
||||
tmux-navigator.enable = true;
|
||||
todo-comments.enable = true;
|
||||
lualine = { enable = true; };
|
||||
aerial.enable = true;
|
||||
treesitter = {
|
||||
enable = true;
|
||||
nixGrammars = true;
|
||||
settings = {
|
||||
ensure_installed = "all";
|
||||
indent.enable = true;
|
||||
highlight.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
keymaps = [{
|
||||
key = "<leader>ct";
|
||||
action = "<cmd>AerialToggle<cr>";
|
||||
options.desc = "Aerial (tags)";
|
||||
}];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user