init
This commit is contained in:
commit
6eae514dab
15 changed files with 500 additions and 0 deletions
29
plugins/completion.nix
Normal file
29
plugins/completion.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{...}: {
|
||||
vim = {
|
||||
autocomplete.nvim-cmp = {
|
||||
enable = true;
|
||||
mappings = {
|
||||
complete = "<C-Space>";
|
||||
close = "<C-e>";
|
||||
scrollDocsUp = "<C-b>";
|
||||
scrollDocsDown = "<C-f>";
|
||||
confirm = "<CR>";
|
||||
next = "<C-j>";
|
||||
previous = "<C-k>";
|
||||
};
|
||||
};
|
||||
|
||||
snippets.luasnip.enable = true;
|
||||
|
||||
luaConfigRC.luasnip-keymaps = ''
|
||||
vim.keymap.set({"i", "s"}, "<C-l>", function()
|
||||
local ls = require("luasnip")
|
||||
if ls.expand_or_jumpable() then ls.expand_or_jump() end
|
||||
end, {silent = true})
|
||||
vim.keymap.set({"i", "s"}, "<C-h>", function()
|
||||
local ls = require("luasnip")
|
||||
if ls.jumpable(-1) then ls.jump(-1) end
|
||||
end, {silent = true})
|
||||
'';
|
||||
};
|
||||
}
|
||||
42
plugins/editing.nix
Normal file
42
plugins/editing.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{pkgs, ...}: {
|
||||
vim = {
|
||||
autopairs.nvim-autopairs.enable = true;
|
||||
comments.comment-nvim.enable = true;
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; {
|
||||
flash-nvim = {
|
||||
package = flash-nvim;
|
||||
setup = ''require("flash").setup({})'';
|
||||
};
|
||||
trouble-nvim = {
|
||||
package = trouble-nvim;
|
||||
setup = ''require("trouble").setup({})'';
|
||||
};
|
||||
inc-rename-nvim = {
|
||||
package = inc-rename-nvim;
|
||||
setup = ''require("inc_rename").setup({})'';
|
||||
};
|
||||
dressing-nvim = {
|
||||
package = dressing-nvim;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
# Flash
|
||||
{key = "s"; mode = ["n" "x" "o"]; lua = true; action = ''function() require("flash").jump() end''; desc = "Flash";}
|
||||
{key = "S"; mode = ["n" "x" "o"]; lua = true; action = ''function() require("flash").treesitter() end''; desc = "Flash Treesitter";}
|
||||
{key = "R"; mode = ["o" "x"]; lua = true; action = ''function() require("flash").treesitter_search() end''; desc = "Treesitter Search";}
|
||||
|
||||
# Trouble
|
||||
{key = "<leader>lD"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "diagnostics"}) end''; desc = "Workspace Diagnostics";}
|
||||
{key = "<leader>ld"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "diagnostics", filter = {buf = 0}}) end''; desc = "Document Diagnostics";}
|
||||
{key = "<leader>lx"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "lsp_definitions"}) end''; desc = "Lsp Definitions";}
|
||||
{key = "<leader>lt"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "lsp_type_definitions"}) end''; desc = "Lsp Type Definitions";}
|
||||
{key = "<leader>li"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "lsp_implementations"}) end''; desc = "Lsp Implementations";}
|
||||
{key = "<leader>lr"; mode = ["n"]; lua = true; action = ''function() require("trouble").open({mode = "lsp_references"}) end''; desc = "Lsp References";}
|
||||
|
||||
# Inc-rename (expr = true to build the command string dynamically)
|
||||
{key = "<leader>ln"; mode = ["n"]; lua = true; expr = true; action = ''function() return ":IncRename " .. vim.fn.expand("<cword>") end''; desc = "LSP Rename";}
|
||||
];
|
||||
};
|
||||
}
|
||||
17
plugins/formatter.nix
Normal file
17
plugins/formatter.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{...}: {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft = {
|
||||
lua = ["stylua"];
|
||||
rust = ["rustfmt"];
|
||||
nix = ["alejandra"];
|
||||
python = ["black"];
|
||||
};
|
||||
format_on_save = {
|
||||
timeout_ms = 2000;
|
||||
lsp_format = "fallback";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
plugins/git.nix
Normal file
6
plugins/git.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{...}: {
|
||||
vim.git = {
|
||||
gitsigns.enable = true;
|
||||
vim-fugitive.enable = true;
|
||||
};
|
||||
}
|
||||
23
plugins/keymaps.nix
Normal file
23
plugins/keymaps.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{...}: {
|
||||
vim.keymaps = [
|
||||
# Page navigation (centered)
|
||||
{key = "<C-d>"; mode = ["n"]; action = "<C-d>zz"; desc = "Page down centered";}
|
||||
{key = "<C-u>"; mode = ["n"]; action = "<C-u>zz"; desc = "Page up centered";}
|
||||
|
||||
# Quickfix navigation
|
||||
{key = "]c"; mode = ["n"]; action = "<cmd>cnext<CR>"; desc = "Next quickfix";}
|
||||
{key = "[c"; mode = ["n"]; action = "<cmd>cprev<CR>"; desc = "Prev quickfix";}
|
||||
|
||||
# Split management
|
||||
{key = "<leader>sv"; mode = ["n"]; action = "<C-w>v"; desc = "Split vertically";}
|
||||
{key = "<leader>sh"; mode = ["n"]; action = "<C-w>s"; desc = "Split horizontally";}
|
||||
{key = "<leader>se"; mode = ["n"]; action = "<C-w>="; desc = "Equal splits";}
|
||||
{key = "<leader>sx"; mode = ["n"]; action = "<cmd>close<CR>"; desc = "Close split";}
|
||||
|
||||
# Tab management
|
||||
{key = "<leader>tx"; mode = ["n"]; action = "<cmd>tabclose<CR>"; desc = "Close tab";}
|
||||
{key = "<leader>tn"; mode = ["n"]; action = "<cmd>tabnew<CR>"; desc = "New tab";}
|
||||
{key = "<Tab>"; mode = ["n"]; action = "<cmd>tabnext<CR>"; desc = "Next tab";}
|
||||
{key = "<S-Tab>"; mode = ["n"]; action = "<cmd>tabprevious<CR>"; desc = "Prev tab";}
|
||||
];
|
||||
}
|
||||
61
plugins/lsp.nix
Normal file
61
plugins/lsp.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{...}: {
|
||||
vim = {
|
||||
lsp.enable = true;
|
||||
|
||||
languages = {
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
enableExtraDiagnostics = true;
|
||||
|
||||
python = {
|
||||
enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = ["ty"];
|
||||
};
|
||||
format = {
|
||||
enable = true;
|
||||
type = ["black"];
|
||||
};
|
||||
};
|
||||
|
||||
lua = {
|
||||
enable = true;
|
||||
lsp.enable = true;
|
||||
format.enable = true;
|
||||
};
|
||||
|
||||
rust = {
|
||||
enable = true;
|
||||
lsp.enable = true;
|
||||
extensions.crates-nvim.enable = true;
|
||||
format.enable = true;
|
||||
};
|
||||
|
||||
nix = {
|
||||
enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = ["nil"];
|
||||
};
|
||||
format = {
|
||||
enable = true;
|
||||
type = ["alejandra"];
|
||||
};
|
||||
};
|
||||
|
||||
clang = {
|
||||
enable = true;
|
||||
lsp.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{key = "<leader>ls"; mode = ["n"]; action = "<cmd>FzfLua lsp_document_symbols<cr>"; desc = "Document Symbols";}
|
||||
{key = "<leader>lS"; mode = ["n"]; action = "<cmd>FzfLua lsp_live_workspace_symbols<cr>"; desc = "Workspace Symbols";}
|
||||
{key = "<leader>la"; mode = ["n"]; lua = true; action = "function() vim.lsp.buf.code_action() end"; desc = "Code Actions";}
|
||||
{key = "K"; mode = ["n"]; lua = true; action = "function() vim.lsp.buf.hover() end"; desc = "Hover Docs";}
|
||||
{key = "<leader>lR"; mode = ["n"]; action = "<cmd>LspRestart<CR>"; desc = "Restart LSP";}
|
||||
];
|
||||
};
|
||||
}
|
||||
36
plugins/navigation.nix
Normal file
36
plugins/navigation.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{...}: {
|
||||
vim = {
|
||||
fzf-lua = {
|
||||
enable = true;
|
||||
profile = "telescope";
|
||||
};
|
||||
|
||||
filetree.nvimTree = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
filters.dotfiles = false;
|
||||
git.enable = true;
|
||||
renderer.group_empty = true;
|
||||
};
|
||||
};
|
||||
|
||||
session.nvim-session-manager.enable = true;
|
||||
|
||||
keymaps = [
|
||||
# FZF-lua
|
||||
{key = "<leader>ff"; mode = ["n"]; action = "<cmd>FzfLua files<cr>"; desc = "Find Files";}
|
||||
{key = "<leader>fg"; mode = ["n"]; action = "<cmd>FzfLua live_grep<cr>"; desc = "Live Grep";}
|
||||
{key = "<leader>fb"; mode = ["n"]; action = "<cmd>FzfLua buffers<cr>"; desc = "Buffer List";}
|
||||
{key = "<leader>fh"; mode = ["n"]; action = "<cmd>FzfLua help_tags<cr>"; desc = "Help Tags";}
|
||||
{key = "<leader>fo"; mode = ["n"]; action = "<cmd>FzfLua oldfiles<cr>"; desc = "Recent Files";}
|
||||
{key = "<leader>fn"; mode = ["n"]; action = "<cmd>FzfLua notify<cr>"; desc = "Notifications";}
|
||||
|
||||
# Nvim-tree
|
||||
{key = "<leader><leader>"; mode = ["n"]; action = "<cmd>NvimTreeToggle<CR>"; desc = "File Tree";}
|
||||
{key = "<leader>e"; mode = ["n"]; action = "<cmd>NvimTreeFindFile<CR>"; desc = "File Tree (find current file)";}
|
||||
|
||||
# Sessions
|
||||
{key = "<leader>fp"; mode = ["n"]; action = "<cmd>SessionManager load_session<CR>"; desc = "Session List";}
|
||||
];
|
||||
};
|
||||
}
|
||||
28
plugins/options.nix
Normal file
28
plugins/options.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{lib, ...}: {
|
||||
vim = {
|
||||
globals.mapleader = ",";
|
||||
|
||||
lineNumberMode = "relNumber";
|
||||
hideSearchHighlight = true;
|
||||
searchCase = "smart";
|
||||
undoFile.enable = true;
|
||||
|
||||
clipboard = {
|
||||
enable = true;
|
||||
registers = "unnamedplus";
|
||||
};
|
||||
|
||||
luaConfigRC.options = lib.nvim.dag.entryAfter ["globalsScript"] ''
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.sessionoptions = "curdir,folds,globals,help,tabpages,terminal,winsize"
|
||||
vim.opt.timeoutlen = 300
|
||||
'';
|
||||
};
|
||||
}
|
||||
18
plugins/statusline.nix
Normal file
18
plugins/statusline.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{pkgs, ...}: {
|
||||
vim.extraPlugins.lualine-nvim = {
|
||||
package = pkgs.vimPlugins.lualine-nvim;
|
||||
setup = ''
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "catppuccin",
|
||||
globalstatus = true,
|
||||
section_separators = {
|
||||
left = string.char(0xEE, 0x82, 0xB4),
|
||||
right = string.char(0xEE, 0x82, 0xB6),
|
||||
},
|
||||
component_separators = { left = "|", right = "|" },
|
||||
},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
8
plugins/theme.nix
Normal file
8
plugins/theme.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{...}: {
|
||||
vim.theme = {
|
||||
enable = true;
|
||||
name = "catppuccin";
|
||||
style = "mocha";
|
||||
transparent = true;
|
||||
};
|
||||
}
|
||||
41
plugins/ui.nix
Normal file
41
plugins/ui.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{...}: {
|
||||
vim = {
|
||||
visuals.indent-blankline.enable = true;
|
||||
|
||||
mini = {
|
||||
icons.enable = true;
|
||||
surround.enable = true;
|
||||
};
|
||||
|
||||
luaConfigRC.mini-icons-mock = ''
|
||||
require("mini.icons").mock_nvim_web_devicons()
|
||||
'';
|
||||
|
||||
binds.whichKey = {
|
||||
enable = true;
|
||||
setupOpts.delay = 300;
|
||||
};
|
||||
|
||||
ui.noice = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
lsp.override = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
};
|
||||
presets = {
|
||||
lsp_doc_border = true;
|
||||
bottom_search = true;
|
||||
long_message_to_split = true;
|
||||
inc_rename = true;
|
||||
};
|
||||
messages.enabled = false;
|
||||
};
|
||||
};
|
||||
|
||||
dashboard.alpha = {
|
||||
enable = true;
|
||||
theme = "dashboard";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue