refactor(nvim): keybinding mess

nixos
Moritz Böhme 2023-10-28 15:18:59 +02:00
parent 8bc546daf0
commit 528098839d
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
4 changed files with 30 additions and 56 deletions

View File

@ -31,13 +31,12 @@ with builtins;
} }
{ {
plugin = trouble-nvim; plugin = trouble-nvim;
cmd = [ "TodoTelescope" ];
keys = [ keys = [
{ key = "<leader>xx"; cmd = "<cmd>TroubleToggle document_diagnostics<cr>"; desc = "Document Diagnostics (Trouble)"; } { key = "<leader>cD"; 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>cW"; cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>"; desc = "Workspace Diagnostics (Trouble)"; }
{ key = "<leader>xl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; } { key = "<leader>cl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; }
{ key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; } { key = "<leader>cq"; 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)"; }
{ key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; } { key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
{ {
key = "[q"; key = "[q";
@ -223,7 +222,7 @@ with builtins;
]; ];
cmd = [ "Telekasten" ]; cmd = [ "Telekasten" ];
keys = [ keys = [
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; } { key = "<leader>fz"; cmd = "<cmd>Telekasten<cr>"; desc = "Zettelkasten"; }
]; ];
conf = builtins.readFile ./lua/zettelkasten-nvim.lua; conf = builtins.readFile ./lua/zettelkasten-nvim.lua;
} }
@ -268,26 +267,18 @@ with builtins;
{ {
plugin = refactoring-nvim; plugin = refactoring-nvim;
keys = [ 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>cR";
{ key = "<leader>rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; } cmd = "<cmd>lua require('telescope').extensions.refactoring.refactors()<cr>";
{ key = "<leader>ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; } desc = "Refactor";
{ key = "<leader>rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; } mode = [ "x" "n" ];
{ 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 = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = plenary-nvim; } { plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; } { plugin = nvim-lspconfig; }
]; ];
init = /* lua */ ''
require("which-key").register({
["<leader>r"] = {
name = "refactoring",
},
})
'';
opts = { }; opts = { };
} }
{ {
@ -295,12 +286,22 @@ with builtins;
keys = [ keys = [
{ key = "<leader>ha"; cmd = "<cmd>lua require('harpoon.mark').add_file()<cr>"; desc = "Add file"; } { 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>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>1"; 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>2"; 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>3"; 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"; } { key = "<leader>4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
]; ];
opts = { }; opts = { };
init = /* lua */ ''
require("which-key").register({
["<leader>h"] = {
name = "harpoon",
},
})
'';
dependencies = [
{ plugin = which-key-nvim; }
];
} }
{ {
plugin = nvim-puppeteer; plugin = nvim-puppeteer;
@ -308,7 +309,6 @@ with builtins;
} }
{ {
plugin = neotest; plugin = neotest;
lazy = false;
keys = [ keys = [
{ key = "<leader>ct"; cmd = "<cmd>lua require('neotest').summary.toggle()<cr>"; desc = "Test"; } { key = "<leader>ct"; cmd = "<cmd>lua require('neotest').summary.toggle()<cr>"; desc = "Test"; }
]; ];
@ -317,12 +317,7 @@ with builtins;
{ plugin = FixCursorHold-nvim; } { plugin = FixCursorHold-nvim; }
# adapters # adapters
{ { plugin = neotest-python; }
plugin = neotest-python;
conf = /* lua */ ''
vim.opt.runtimepath:append("${neotest-python}")
'';
}
]; ];
conf = readFile ./lua/neotest.lua; conf = readFile ./lua/neotest.lua;
} }

View File

@ -5,8 +5,6 @@ null_ls.setup({
-- Code actions -- Code actions
null_ls.builtins.code_actions.shellcheck, null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.code_actions.statix, null_ls.builtins.code_actions.statix,
-- Completion
null_ls.builtins.completion.spell,
-- Diagnostics -- Diagnostics
null_ls.builtins.diagnostics.checkmake, null_ls.builtins.diagnostics.checkmake,
null_ls.builtins.diagnostics.deadnix, null_ls.builtins.diagnostics.deadnix,
@ -19,19 +17,3 @@ null_ls.setup({
null_ls.builtins.diagnostics.yamllint, null_ls.builtins.diagnostics.yamllint,
}, },
}) })
-- disable (c)spell initially
null_ls.disable("spell")
-- make sources toggle able
require("which-key").register({
n = {
name = "null-ls",
s = {
function()
null_ls.toggle("spell")
end,
"spell",
},
},
}, { prefix = "<leader>t" })

View File

@ -32,9 +32,8 @@ local on_attach_def = function(client, bufnr)
"Hover", "Hover",
}, },
["<leader>"] = { ["<leader>"] = {
l = { c = {
name = "lsp", name = "code",
d = { vim.diagnostic.open_float, "Open diagnostic window" },
c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } }, c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } },
r = { r = {
function() function()

View File

@ -35,11 +35,9 @@ require("which-key").register({
["<leader>"] = { ["<leader>"] = {
f = { name = "file/find" }, f = { name = "file/find" },
g = { name = "git" }, g = { name = "git" },
l = { name = "lsp" }, c = { name = "code" },
o = { name = "org" },
s = { name = "search" }, s = { name = "search" },
t = { name = "toggle" }, t = { name = "toggle" },
x = { name = "diagnostics/quickfix" },
}, },
["["] = { name = "prev" }, ["["] = { name = "prev" },
["]"] = { name = "next" }, ["]"] = { name = "next" },