dotfiles/modules/programs/nvim/plugins/coding.nix

322 lines
9.5 KiB
Nix
Raw Normal View History

2023-09-17 09:35:10 +02:00
{ pkgs, lib, ... }:
2023-06-10 21:52:57 +02:00
with builtins;
{
2023-09-17 09:35:10 +02:00
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
2023-06-10 21:52:57 +02:00
{
plugin = formatter-nvim;
2023-09-10 13:30:29 +02:00
cmd = [ "Format" "Fmt" ];
2023-06-10 21:52:57 +02:00
keys = [
2023-09-10 13:30:29 +02:00
{
key = "=";
cmd = "<cmd>Format<cr>";
desc = "format (formatter)";
}
2023-06-10 21:52:57 +02:00
];
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/formatter-nvim.lua;
2023-06-10 21:52:57 +02:00
}
{
plugin = oil-nvim;
lazy = false;
2023-09-10 13:30:29 +02:00
opts = { };
2023-06-10 21:52:57 +02:00
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; }
2023-06-10 21:52:57 +02:00
];
}
{
plugin = mini-nvim;
lazy = false;
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/mini-nvim.lua;
2023-06-10 21:52:57 +02:00
}
{
plugin = trouble-nvim;
keys = [
{ key = "<leader>xx"; cmd = "<cmd>TroubleToggle document_diagnostics<cr>"; desc = "Document Diagnostics (Trouble)"; }
{ key = "<leader>xX"; cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>"; desc = "Workspace Diagnostics (Troule)"; }
{ key = "<leader>xl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; }
{ key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; }
{ key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; }
{ key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; }
2023-09-10 13:30:29 +02:00
{ key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
2023-06-10 21:52:57 +02:00
{
key = "[q";
2023-09-10 13:30:29 +02:00
func = /* lua */ ''
function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end
'';
2023-06-10 21:52:57 +02:00
desc = "Previous trouble/quickfix item";
}
{
key = "]q";
2023-09-10 13:30:29 +02:00
func = /* lua */ ''
function()
if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end
'';
2023-06-10 21:52:57 +02:00
desc = "Next trouble/quickfix item";
}
];
2023-09-10 13:30:29 +02:00
opts = { };
2023-06-10 21:52:57 +02:00
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; }
2023-06-10 21:52:57 +02:00
];
}
{
plugin = nvim-cmp;
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/nvim-cmp.lua;
event = [ "InsertEnter" ];
dependencies = [
{
plugin = nvim-autopairs;
2023-09-10 13:30:29 +02:00
opts = { };
}
{ plugin = cmp-async-path; }
2023-09-06 17:45:31 +02:00
{ plugin = cmp-buffer; }
{ plugin = cmp-cmdline; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{ plugin = friendly-snippets; }
2023-09-06 17:45:31 +02:00
{ plugin = lspkind-nvim; }
{ plugin = luasnip; }
2023-09-17 09:36:22 +02:00
{
plugin = copilot-cmp;
opts = { };
dependencies = [
{
plugin = copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
};
conf = /* lua */ ''
require("copilot").setup(opts)
vim.cmd("Copilot disable")
'';
}
];
}
];
}
2023-06-10 21:52:57 +02:00
{
plugin = direnv-vim;
lazy = false;
2023-06-10 21:52:57 +02:00
}
{
plugin = nvim-lspconfig;
2023-08-12 11:50:46 +02:00
event = [ "BufRead" "BufNewFile" ];
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/nvim-lspconfig.lua;
2023-06-10 21:52:57 +02:00
dependencies = [
2023-09-06 17:48:54 +02:00
{ plugin = lsp_signature-nvim; }
2023-06-10 21:52:57 +02:00
{
plugin = null-ls-nvim;
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/null-ls-nvim.lua;
2023-06-10 21:52:57 +02:00
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
2023-06-10 21:52:57 +02:00
];
}
{ plugin = which-key-nvim; }
{ plugin = lsp_lines-nvim; }
2023-06-10 21:52:57 +02:00
{
plugin = nvim-ufo;
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/nvim-ufo.lua;
2023-06-10 21:52:57 +02:00
dependencies = [
{ plugin = promise-async; }
2023-06-10 21:52:57 +02:00
];
}
2023-08-12 08:07:33 +02:00
{
plugin = neodev-nvim;
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/neodev-nvim.lua;
2023-08-12 08:07:33 +02:00
}
2023-08-12 16:46:45 +02:00
{
plugin = inc-rename-nvim;
2023-09-10 13:30:29 +02:00
opts = {
input_buffer_type = "dressing";
};
2023-08-12 16:46:45 +02:00
dependencies = [
2023-09-10 13:30:29 +02:00
{ plugin = dressing-nvim; }
2023-08-12 16:46:45 +02:00
];
}
2023-09-06 08:43:03 +02:00
{ plugin = actions-preview-nvim; }
2023-06-10 21:52:57 +02:00
];
}
{
plugin = vim-fugitive;
2023-09-07 08:02:32 +02:00
cmd = [
"G"
"Git"
"Ggrep"
"Glgrep"
"Gclog"
"Gllog"
"Gcd"
"Glcd"
"Gedit"
"Gsplit"
"Gvsplit"
"Gtabedit"
"Gpedit"
"Gdrop"
"Gread"
"Gwrite"
"Gwq"
"Gdiffsplit"
"Gvdiffsplit"
"GMove"
"GRename"
"GDelete"
"GBrowse"
];
2023-06-10 21:52:57 +02:00
}
{
plugin = vim-tmux-navigator;
event = [ "VeryLazy" ];
2023-06-10 21:52:57 +02:00
}
{
plugin = nvim-lastplace;
event = [ "BufReadPost" "BufNewFile" ];
2023-09-10 13:30:29 +02:00
opts = {
lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ];
lastplace_ignore_filetype = [ "gitcommit" "gitrebase" "svn" "hgcommit" ];
lastplace_open_folds = true;
};
2023-06-10 21:52:57 +02:00
}
{
plugin = telescope-nvim;
cmd = [ "Telescope" ];
2023-09-10 13:30:29 +02:00
conf = builtins.readFile ./lua/telescope.lua;
2023-06-10 21:52:57 +02:00
keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
2023-09-10 13:30:29 +02:00
{ key = "<leader>fl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; }
{ key = "<leader>fg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; }
{ key = "<leader>fh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
2023-06-10 21:52:57 +02:00
];
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = telescope-fzf-native-nvim; }
2023-06-10 21:52:57 +02:00
];
}
{
plugin = vim-startuptime;
cmd = [ "StartupTime" ];
2023-09-10 13:30:29 +02:00
conf = readFile ./lua/vim-startuptime.lua;
}
2023-06-25 11:15:08 +02:00
{
plugin = typst-vim;
ft = [ "typst" "typ" ];
}
{
plugin = comment-nvim;
event = [ "BufReadPost" "BufNewFile" ];
2023-09-10 13:30:29 +02:00
opts = { };
}
2023-07-15 12:29:13 +02:00
{
plugin = telekasten-nvim;
dependencies = [
{ plugin = telescope-nvim; }
{ plugin = which-key-nvim; }
2023-09-10 13:30:29 +02:00
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
2023-07-15 12:29:13 +02:00
];
cmd = [ "Telekasten" ];
keys = [
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; }
];
2023-09-10 13:30:29 +02:00
conf = builtins.readFile ./lua/zettelkasten-nvim.lua;
2023-07-15 12:49:32 +02:00
}
{
plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ];
2023-09-10 13:30:29 +02:00
opts = { };
2023-08-11 18:59:52 +02:00
}
2023-08-16 16:42:26 +02:00
{
plugin = zen-mode-nvim;
keys = [
{ key = "<leader>tz"; cmd = "<cmd>ZenMode<cr>"; desc = "Zen mode"; }
];
2023-09-07 09:09:12 +02:00
conf = /* lua */ ''
require("zen-mode").setup({
plugins = {
tmux = {
enabled = true,
},
},
})
'';
2023-08-16 16:42:26 +02:00
dependencies = [
2023-09-07 09:09:12 +02:00
{
plugin = twilight-nvim;
conf = /* lua */ ''
require("twilight").setup({
context = 20,
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
"function",
"function_definition",
"if_statement",
"method",
"method_definition",
"table",
},
})
'';
}
2023-08-16 16:42:26 +02:00
];
}
2023-09-10 13:30:29 +02:00
{
plugin = refactoring-nvim;
keys = [
{ key = "<leader>re"; cmd = ": Refactor eextract "; desc = "Extract"; mode = [ "x" ]; }
{ key = "<leader>rf"; cmd = ": Refactor extract_to_file "; desc = "Extract to file"; mode = [ "x" ]; }
{ key = "<leader>rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; }
{ key = "<leader>ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; }
{ key = "<leader>rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; }
{ key = "<leader>rb"; cmd = ": Refactor extract_block"; desc = "Extract block"; mode = [ "n" ]; }
{ key = "<leader>rbf"; cmd = ": Refactor extract_block_to_file"; desc = "Extract block to file"; mode = [ "n" ]; }
];
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; }
];
init = /* lua */ ''
require("which-key").register({
["<leader>r"] = {
name = "refactoring",
},
})
'';
opts = { };
}
2023-09-10 13:35:13 +02:00
{
plugin = harpoon;
keys = [
{ key = "<leader>ha"; cmd = "<cmd>lua require('harpoon.mark').add_file()<cr>"; desc = "Add file"; }
{ key = "<leader>hh"; cmd = "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>"; desc = "Harpoon"; }
{ key = "<leader>h1"; cmd = "<cmd>lua require('harpoon.ui').nav_file(1)<cr>"; desc = "Harpoon file 1"; }
{ key = "<leader>h2"; cmd = "<cmd>lua require('harpoon.ui').nav_file(2)<cr>"; desc = "Harpoon file 2"; }
{ key = "<leader>h3"; cmd = "<cmd>lua require('harpoon.ui').nav_file(3)<cr>"; desc = "Harpoon file 3"; }
{ key = "<leader>h4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
];
opts = { };
}
{
plugin = nvim-puppeteer;
lazy = false; # NOTE: plugin lazy-loads itself.
}
2023-06-10 21:52:57 +02:00
];
}