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

404 lines
12 KiB
Nix
Raw Normal View History

2024-02-12 10:10:32 +01:00
{ pkgs, lib, inputs, ... }:
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 = 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;
2023-10-28 15:18:59 +02:00
cmd = [ "TodoTelescope" ];
2023-06-10 21:52:57 +02:00
keys = [
{
key = "<leader>cD";
cmd = "<cmd>TroubleToggle document_diagnostics<cr>";
desc = "Document Diagnostics (Trouble)";
}
{
key = "<leader>cW";
cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>";
desc = "Workspace Diagnostics (Trouble)";
}
2023-10-28 15:18:59 +02:00
{ key = "<leader>cl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; }
{ key = "<leader>cq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (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 = nvim-web-devicons; }
2023-06-10 21:52:57 +02:00
];
}
{
plugin = nvim-cmp;
keys = [
{ key = "<leader>tc"; cmd = "<cmd>CmpToggle<cr>"; desc = "Toggle Cmp sources"; }
];
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; }
2023-09-17 09:36:22 +02:00
{
2024-01-06 11:45:54 +01:00
plugin = copilot-cmp;
2023-09-17 09:36:22 +02:00
opts = { };
2024-01-06 11:45:54 +01:00
dependencies = [
{
plugin = copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
};
conf = /* lua */ ''
require("copilot").setup(opts)
vim.cmd("Copilot disable")
'';
}
];
2023-09-17 09:36:22 +02:00
}
{ plugin = friendly-snippets; }
{ plugin = lspkind-nvim; }
{ plugin = luasnip; }
];
}
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 = [
{
2024-02-12 10:10:32 +01:00
plugin = pkgs.vimPlugins.null-ls-nvim.overrideAttrs (_: {
version = lib.my.mkVersionInput inputs.none-ls-nvim;
src = inputs.none-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
];
}
2024-02-12 10:10:32 +01:00
{
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "actions-preview-nvim";
version = lib.my.mkVersionInput inputs.actions-preview-nvim;
src = inputs.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>fl";
cmd = "y<ESC>:Telescope current_buffer_fuzzy_find default_text=<c-r>0<CR>";
desc = "Search lines (selection)";
mode = [ "v" ];
}
2023-09-10 13:30:29 +02:00
{ key = "<leader>fg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; }
{
key = "<leader>fg";
cmd = "y<ESC>:Telescope live_grep default_text=<c-r>0<CR>";
desc = "Live grep (selection)";
mode = [ "v" ];
}
2023-09-10 13:30:29 +02:00
{ key = "<leader>fh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
{ key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Recent files"; }
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 = [
2023-10-28 15:18:59 +02:00
{ key = "<leader>fz"; cmd = "<cmd>Telekasten<cr>"; desc = "Zettelkasten"; }
2023-07-15 12:29:13 +02:00
];
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 = [
2023-10-28 15:18:59 +02:00
{
key = "<leader>cR";
cmd = "<cmd>lua require('telescope').extensions.refactoring.refactors()<cr>";
desc = "Refactor";
mode = [ "x" "n" ];
}
2023-09-10 13:30:29 +02:00
];
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; }
];
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"; }
2023-10-28 15:18:59 +02:00
{ key = "<leader>1"; cmd = "<cmd>lua require('harpoon.ui').nav_file(1)<cr>"; desc = "Harpoon file 1"; }
{ key = "<leader>2"; cmd = "<cmd>lua require('harpoon.ui').nav_file(2)<cr>"; desc = "Harpoon file 2"; }
{ key = "<leader>3"; cmd = "<cmd>lua require('harpoon.ui').nav_file(3)<cr>"; desc = "Harpoon file 3"; }
{ key = "<leader>4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
2023-09-10 13:35:13 +02:00
];
opts = { };
2023-10-28 15:18:59 +02:00
init = /* lua */ ''
require("which-key").register({
["<leader>h"] = {
name = "harpoon",
},
})
'';
dependencies = [
{ plugin = which-key-nvim; }
];
2023-09-10 13:35:13 +02:00
}
{
2024-02-12 10:10:32 +01:00
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "nvim-puppeteer";
version = lib.my.mkVersionInput inputs.nvim-puppeteer;
src = inputs.nvim-puppeteer;
};
lazy = false; # NOTE: plugin lazy-loads itself.
}
2023-10-27 19:31:03 +02:00
{
plugin = neotest;
keys = [
{ key = "<leader>ct"; cmd = "<cmd>lua require('neotest').summary.toggle()<cr>"; desc = "Test"; }
];
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = FixCursorHold-nvim; }
# adapters
2023-10-28 15:18:59 +02:00
{ plugin = neotest-python; }
2023-10-27 19:31:03 +02:00
];
conf = readFile ./lua/neotest.lua;
}
{
plugin = conform-nvim;
keys = [
{ key = "="; cmd = "<cmd>lua require('conform').format()<cr>"; desc = "format buffer"; mode = [ "n" "v" ]; }
];
cmd = [ "ConformInfo" "Format" ];
conf = readFile ./lua/conform.lua;
}
2023-11-30 14:45:42 +01:00
{
plugin = neogen;
keys = [
{ key = "<leader>cg"; cmd = "<cmd>Neogen<cr>"; desc = "Test"; }
];
opts = {
languages = {
python = {
template = {
annotation_convention = "reST";
};
};
};
};
cmd = [ "Neogen" ];
}
{
plugin = gen-nvim;
init = /* lua */ ''
require("gen").setup({
model = "zephyr:7b-beta", -- The default model to use.
display_mode = "float", -- The display mode. Can be "float" or "split".
show_prompt = false, -- Shows the Prompt submitted to Ollama.
show_model = false, -- Displays which model you are using at the beginning of your chat session.
no_auto_close = false, -- Never closes the window automatically.
init = function(options) end,
-- Function to initialize Ollama
command = "${lib.getExe pkgs.curl} --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body",
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
-- This can also be a lua function returning a command string, with options as the input parameter.
-- The executed command must return a JSON object with { response, context }
-- (context property is optional).
debug = false -- Prints errors and the command which is run.
})
'';
}
2023-06-10 21:52:57 +02:00
];
}