Compare commits

...

3 commits

Author SHA1 Message Date
Bruno BELANYI ef2efdcf0c home: vim: update for 'which-key' v3
Some checks failed
ci/woodpecker/push/check Pipeline failed
It complains quite loudly about the legacy mapping syntax.
2024-07-25 19:23:42 +01:00
Bruno BELANYI b042011542 nixos: system: packages: fix deprecated config 2024-07-25 19:22:15 +01:00
Bruno BELANYI cf26edaa48 flake: bump inputs
Add fix renamed packages.
2024-07-25 19:22:15 +01:00
10 changed files with 232 additions and 215 deletions

View file

@ -14,11 +14,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718371084, "lastModified": 1720546205,
"narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=", "narHash": "sha256-boCXsjYVxDviyzoEyAk624600f3ZBo/DKtUdvMTpbGY=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "3a56735779db467538fb2e577eda28a9daacaca6", "rev": "de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,11 +73,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1717285511, "lastModified": 1719994518,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -136,11 +136,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1719438532, "lastModified": 1721852138,
"narHash": "sha256-/Vmso2ZMoFE3M7d1MRsQ2K5sR8CVKnrM6t1ys9Xjpz4=", "narHash": "sha256-JH8N5uoqoVA6erV4O40VtKKHsnfmhvMGbxMNDLtim5o=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1a4f12ae0bda877ec4099b429cf439aad897d7e9", "rev": "304a011325b7ac7b8c9950333cd215a7aa146b0e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -152,11 +152,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1719254875, "lastModified": 1721743106,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "narHash": "sha256-adRZhFpBTnHiK3XIELA3IBaApz70HwCYfv7xNrHjebA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", "rev": "dc14ed91132ee3a26255d01d8fd0c1f5bff27b2f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -168,11 +168,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1719564461, "lastModified": 1721930286,
"narHash": "sha256-wCFs1sf1tPoV3nCG5N5KaakAKm88FyzN6pRdOsOqNZg=", "narHash": "sha256-IUr/laHRe52MkPlOSflG1GThgQo+ECmAP7O51RxLduI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "7369862c4a8f293f6fde79044369dad7dfc04798", "rev": "3ea857d2abb7f3825976cefc50894d35ca55f8c4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -194,11 +194,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1719259945, "lastModified": 1721042469,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -21,12 +21,12 @@ in
}; };
iconTheme = { iconTheme = {
package = pkgs.gnome.gnome-themes-extra; package = pkgs.gnome-themes-extra;
name = "Adwaita"; name = "Adwaita";
}; };
theme = { theme = {
package = pkgs.gnome.gnome-themes-extra; package = pkgs.gnome-themes-extra;
name = "Adwaita"; name = "Adwaita";
}; };
}; };

View file

@ -1,7 +1,7 @@
local wk = require("which-key") local wk = require("which-key")
local keys = { local keys = {
["<leader>"] = { "<cmd>nohls<CR>", "Clear search highlight" }, { "<leader><leader>", "<cmd>nohls<CR>", desc = "Clear search highlight" },
} }
wk.register(keys, { prefix = "<leader>" }) wk.add(keys)

View file

@ -3,126 +3,124 @@ local wk = require("which-key")
local lsp = require("ambroisie.lsp") local lsp = require("ambroisie.lsp")
local keys = { local keys = {
-- Edition and navigation mappins -- Previous
["["] = { { "[", group = "Previous" },
name = "Previous", -- Edition and navigation mappings
["<space>"] = "Insert blank line above", { "[<space>", desc = "Insert blank line above" },
["<C-L>"] = "Previous location list file", { "[<C-L>", desc = "Previous location list file" },
["<C-Q>"] = "Previous quickfix list file", { "[<C-Q>", desc = "Previous quickfix list file" },
["<C-T>"] = "Previous tag in preview window", { "[<C-T>", desc = "Previous tag in preview window" },
a = "Previous argument", { "[a", desc = "Previous argument" },
A = "First argument", { "[A", desc = "First argument" },
b = "Previous buffer", { "[b", desc = "Previous buffer" },
B = "First buffer", { "[B", desc = "First buffer" },
e = "Exchange previous line", { "[e", desc = "Exchange previous line" },
f = "Previous file in directory", { "[f", desc = "Previous file in directory" },
l = "Previous location list entry", { "[l", desc = "Previous location list entry" },
L = "First Location list entry", { "[L", desc = "First Location list entry" },
n = "Previous conflict marker/diff hunk", { "[n", desc = "Previous conflict marker/diff hunk" },
p = "Paste line above", { "[p", desc = "Paste line above" },
P = "Paste line above", { "[P", desc = "Paste line above" },
q = "Previous quickfix list entry", { "[q", desc = "Previous quickfix list entry" },
Q = "First quickfix list entry", { "[Q", desc = "First quickfix list entry" },
t = "Previous matching tag", { "[t", desc = "Previous matching tag" },
T = "First matching tag", { "[T", desc = "First matching tag" },
z = "Previous fold", { "[z", desc = "Previous fold" },
-- Encoding -- Encoding
C = "C string encode", { "[C", desc = "C string encode" },
u = "URL encode", { "[u", desc = "URL encode" },
x = "XML encode", { "[x", desc = "XML encode" },
y = "C string encode", { "[y", desc = "C string encode" },
-- Custom -- Custom
d = { lsp.goto_prev_diagnostic, "Previous diagnostic" }, { "[d", lsp.goto_prev_diagnostic, desc = "Previous diagnostic" },
},
["]"] = {
name = "Next",
["<space>"] = "Insert blank line below",
["<C-L>"] = "Next location list file",
["<C-Q>"] = "Next quickfix list file",
["<C-T>"] = "Next tag in preview window",
a = "Next argument",
A = "Last argument",
b = "Next buffer",
B = "Last buffer",
e = "Exchange next line",
f = "Next file in directory",
l = "Next location list entry",
L = "Last Location list entry",
n = "Next conflict marker/diff hunk",
p = "Paste line below",
P = "Paste line below",
q = "Next quickfix list entry",
Q = "Last quickfix list entry",
t = "Next matching tag",
T = "Last matching tag",
z = "Next fold",
-- Decoding
C = "C string decode",
u = "URL decode",
x = "XML decode",
y = "C string decode",
-- Custom
d = { lsp.goto_next_diagnostic, "Next diagnostic" },
},
-- Option mappings -- Next
["[o"] = { { "]", group = "Next" },
name = "Enable option", -- Edition and navigation mappings
b = "Light background", { "]<space>", desc = "Insert blank line below" },
c = "Cursor line", { "]<C-L>", desc = "Next location list file" },
d = "Diff", { "]<C-Q>", desc = "Next quickfix list file" },
f = { "<cmd>FormatEnable<CR>", "LSP Formatting" }, { "]<C-T>", desc = "Next tag in preview window" },
h = "Search high-lighting", { "]a", desc = "Next argument" },
i = "Case insensitive search", { "]A", desc = "Last argument" },
l = "List mode", { "]b", desc = "Next buffer" },
n = "Line numbers", { "]B", desc = "Last buffer" },
r = "Relative line numbers", { "]e", desc = "Exchange next line" },
p = { "<cmd>lwindow<CR>", "Location list" }, { "]f", desc = "Next file in directory" },
q = { "<cmd>cwindow<CR>", "Quickfix list" }, { "]l", desc = "Next location list entry" },
u = "Cursor column", { "]L", desc = "Last Location list entry" },
v = "Virtual editing", { "]n", desc = "Next conflict marker/diff hunk" },
w = "Text wrapping", { "]p", desc = "Paste line below" },
x = "Cursor line and column", { "]P", desc = "Paste line below" },
z = "Spell checking", { "]q", desc = "Next quickfix list entry" },
}, { "]Q", desc = "Last quickfix list entry" },
["]o"] = { { "]t", desc = "Next matching tag" },
name = "Disable option", { "]T", desc = "Last matching tag" },
b = "Light background", { "]z", desc = "Next fold" },
c = "Cursor line", -- Decoding
d = "Diff", { "]C", desc = "C string decode" },
f = { "<cmd>FormatDisable<CR>", "LSP Formatting" }, { "]u", desc = "URL decode" },
h = "Search high-lighting", { "]x", desc = "XML decode" },
i = "Case insensitive search", { "]y", desc = "C string decode" },
l = "List mode", -- Custom
n = "Line numbers", { "]d", lsp.goto_next_diagnostic, desc = "Next diagnostic" },
p = { "<cmd>lclose<CR>", "Location list" },
q = { "<cmd>cclose<CR>", "Quickfix list" }, -- Enable option
r = "Relative line numbers", { "[o", desc = "Enable option" },
u = "Cursor column", { "[ob", desc = "Light background" },
v = "Virtual editing", { "[oc", desc = "Cursor line" },
w = "Text wrapping", { "[od", desc = "Diff" },
x = "Cursor line and column", { "[of", "<cmd>FormatEnable<CR>", desc = "LSP Formatting" },
z = "Spell checking", { "[oh", desc = "Search high-lighting" },
}, { "[oi", desc = "Case insensitive search" },
["yo"] = { { "[ol", desc = "List mode" },
name = "Toggle option", { "[on", desc = "Line numbers" },
b = "Light background", { "[or", desc = "Relative line numbers" },
c = "Cursor line", { "[op", "<cmd>lwindow<CR>", desc = "Location list" },
d = "Diff", { "[oq", "<cmd>cwindow<CR>", desc = "Quickfix list" },
f = { "<cmd>FormatToggle<CR>", "LSP Formatting" }, { "[ou", desc = "Cursor column" },
h = "Search high-lighting", { "[ov", desc = "Virtual editing" },
i = "Case insensitive search", { "[ow", desc = "Text wrapping" },
l = "List mode", { "[ox", desc = "Cursor line and column" },
n = "Line numbers", { "[oz", desc = "Spell checking" },
p = { "<Plug>(qf_loc_toggle)", "Location list" },
q = { "<Plug>(qf_qf_toggle)", "Quickfix list" }, -- Disable option
r = "Relative line numbers", { "]o", desc = "Disable option" },
u = "Cursor column", { "]ob", desc = "Light background" },
v = "Virtual editing", { "]oc", desc = "Cursor line" },
w = "Text wrapping", { "]od", desc = "Diff" },
x = "Cursor line and column", { "]of", "<cmd>FormatDisable<CR>", desc = "LSP Formatting" },
z = "Spell checking", { "]oh", desc = "Search high-lighting" },
}, { "]oi", desc = "Case insensitive search" },
{ "]ol", desc = "List mode" },
{ "]on", desc = "Line numbers" },
{ "]op", "<cmd>lclose<CR>", desc = "Location list" },
{ "]oq", "<cmd>cclose<CR>", desc = "Quickfix list" },
{ "]or", desc = "Relative line numbers" },
{ "]ou", desc = "Cursor column" },
{ "]ov", desc = "Virtual editing" },
{ "]ow", desc = "Text wrapping" },
{ "]ox", desc = "Cursor line and column" },
{ "]oz", desc = "Spell checking" },
-- Toggle option
{ "yo", group = "Toggle option" },
{ "yob", desc = "Light background" },
{ "yoc", desc = "Cursor line" },
{ "yod", desc = "Diff" },
{ "yof", "<cmd>FormatToggle<CR>", desc = "LSP Formatting" },
{ "yoh", desc = "Search high-lighting" },
{ "yoi", desc = "Case insensitive search" },
{ "yol", desc = "List mode" },
{ "yon", desc = "Line numbers" },
{ "yop", "<Plug>(qf_loc_toggle)", desc = "Location list" },
{ "yoq", "<Plug>(qf_qf_toggle)", desc = "Quickfix list" },
{ "yor", desc = "Relative line numbers" },
{ "you", desc = "Cursor column" },
{ "yov", desc = "Virtual editing" },
{ "yow", desc = "Text wrapping" },
{ "yox", desc = "Cursor line and column" },
{ "yoz", desc = "Spell checking" },
} }
wk.register(keys) wk.add(keys)

View file

@ -87,31 +87,30 @@ M.on_attach = function(client, bufnr)
end end
local keys = { local keys = {
K = { vim.lsp.buf.hover, "Show symbol information" }, buffer = bufnr,
["<C-k>"] = { vim.lsp.buf.signature_help, "Show signature information" }, -- LSP navigation
["gd"] = { vim.lsp.buf.definition, "Go to definition" }, { "K", vim.lsp.buf.hover, desc = "Show symbol information" },
["gD"] = { vim.lsp.buf.declaration, "Go to declaration" }, { "<C-k>", vim.lsp.buf.signature_help, desc = "Show signature information" },
["gi"] = { vim.lsp.buf.implementation, "Go to implementation" }, { "gd", vim.lsp.buf.definition, desc = "Go to definition" },
["gr"] = { vim.lsp.buf.references, "List all references" }, { "gD", vim.lsp.buf.declaration, desc = "Go to declaration" },
{ "gi", vim.lsp.buf.implementation, desc = "Go to implementation" },
["<leader>c"] = { { "gr", vim.lsp.buf.references, desc = "List all references" },
name = "Code", -- Code
a = { vim.lsp.buf.code_action, "Code actions" }, { "<leader>c", group = "Code" },
d = { cycle_diagnostics_display, "Cycle diagnostics display" }, { "<leader>ca", vim.lsp.buf.code_action, desc = "Code actions" },
D = { show_buffer_diagnostics, "Show buffer diagnostics" }, { "<leader>cd", cycle_diagnostics_display, desc = "Cycle diagnostics display" },
r = { vim.lsp.buf.rename, "Rename symbol" }, { "<leader>cD", show_buffer_diagnostics, desc = "Show buffer diagnostics" },
s = { vim.lsp.buf.signature_help, "Show signature" }, { "<leader>cr", vim.lsp.buf.rename, desc = "Rename symbol" },
t = { vim.lsp.buf.type_definition, "Go to type definition" }, { "<leader>cs", vim.lsp.buf.signature_help, desc = "Show signature" },
w = { { "<leader>ct", vim.lsp.buf.type_definition, desc = "Go to type definition" },
name = "Workspace", -- Workspace
a = { vim.lsp.buf.add_workspace_folder, "Add folder to workspace" }, { "<leader>cw", group = "Workspace" },
l = { list_workspace_folders, "List folders in workspace" }, { "<leader>cwa", vim.lsp.buf.add_workspace_folder, desc = "Add folder to workspace" },
r = { vim.lsp.buf.remove_workspace_folder, "Remove folder from workspace" }, { "<leader>cwl", list_workspace_folders, desc = "List folders in workspace" },
}, { "<leader>cwr", vim.lsp.buf.remove_workspace_folder, desc = "Remove folder from workspace" },
},
} }
wk.register(keys, { buffer = bufnr }) wk.add(keys)
end end
return M return M

View file

@ -34,47 +34,42 @@ gitsigns.setup({
local keys = { local keys = {
-- Navigation -- Navigation
["[c"] = { utils.partial(nav_hunk, "prev"), "Previous hunk/diff" }, { "[c", utils.partial(nav_hunk, "prev"), desc = "Previous hunk/diff" },
["]c"] = { utils.partial(nav_hunk, "next"), "Next hunk/diff" }, { "]c", utils.partial(nav_hunk, "next"), desc = "Next hunk/diff" },
-- Commands -- Commands
["<leader>g"] = { { "<leader>g", group = "Git" },
name = "Git", { "<leader>gb", gitsigns.toggle_current_line_blame, desc = "Toggle blame virtual text" },
-- Actions { "<leader>gd", gitsigns.diffthis, desc = "Diff buffer" },
b = { gitsigns.toggle_current_line_blame, "Toggle blame virtual text" }, { "<leader>gD", utils.partial(gitsigns.diffthis, "~"), desc = "Diff buffer against last commit" },
d = { gitsigns.diffthis, "Diff buffer" }, { "<leader>gg", "<cmd>Git<CR>", desc = "Git status" },
D = { utils.partial(gitsigns.diffthis, "~"), "Diff buffer against last commit" }, { "<leader>gh", gitsigns.toggle_deleted, desc = "Show deleted hunks" },
g = { "<cmd>Git<CR>", "Git status" }, { "<leader>gL", "<cmd>:sp<CR><C-w>T:Gllog --follow -- %:p<CR>", desc = "Current buffer log" },
h = { gitsigns.toggle_deleted, "Show deleted hunks" }, { "<leader>gm", "<Plug>(git-messenger)", desc = "Current line blame" },
L = { "<cmd>:sp<CR><C-w>T:Gllog --follow -- %:p<CR>", "Current buffer log" }, { "<leader>gp", gitsigns.preview_hunk, desc = "Preview hunk" },
m = { "<Plug>(git-messenger)", "Current line blame" }, { "<leader>gr", gitsigns.reset_hunk, desc = "Restore hunk" },
p = { gitsigns.preview_hunk, "Preview hunk" }, { "<leader>gR", gitsigns.reset_buffer, desc = "Restore buffer" },
r = { gitsigns.reset_hunk, "Restore hunk" }, { "<leader>gs", gitsigns.stage_hunk, desc = "Stage hunk" },
R = { gitsigns.reset_buffer, "Restore buffer" }, { "<leader>gS", gitsigns.stage_buffer, desc = "Stage buffer" },
s = { gitsigns.stage_hunk, "Stage hunk" }, { "<leader>gu", gitsigns.undo_stage_hunk, desc = "Undo stage hunk" },
S = { gitsigns.stage_buffer, "Stage buffer" }, { "<leader>g[", utils.partial(gitsigns.nav_hunk, "prev"), desc = "Previous hunk" },
u = { gitsigns.undo_stage_hunk, "Undo stage hunk" }, { "<leader>g]", utils.partial(gitsigns.nav_hunk, "next"), desc = "Next hunk" },
["["] = { utils.partial(gitsigns.nav_hunk, "prev"), "Previous hunk" },
["]"] = { utils.partial(gitsigns.nav_hunk, "next"), "Next hunk" },
},
} }
local objects = { local objects = {
["ih"] = { gitsigns.select_hunk, "Git hunk" }, mode = "o",
{ "ih", gitsigns.select_hunk, desc = "Git hunk" },
} }
-- Visual
local visual = { local visual = {
["ih"] = { gitsigns.select_hunk, "Git hunk" }, mode = { "x" },
{ "ih", gitsigns.select_hunk, desc = "Git hunk" },
["<leader>g"] = { { "<leader>g", group = "Git" },
name = "Git", { "<leader>gp", gitsigns.preview_hunk, desc = "Preview selection" },
p = { gitsigns.preview_hunk, "Preview selection" }, { "<leader>gr", make_visual(gitsigns.reset_hunk), desc = "Restore selection" },
r = { make_visual(gitsigns.reset_hunk), "Restore selection" }, { "<leader>gs", make_visual(gitsigns.stage_hunk), desc = "Stage selection" },
s = { make_visual(gitsigns.stage_hunk), "Stage selection" }, { "<leader>gu", gitsigns.undo_stage_hunk, desc = "Undo stage selection" },
u = { gitsigns.undo_stage_hunk, "Undo stage selection" },
},
} }
wk.register(keys, { buffer = bufnr }) wk.add(keys)
wk.register(objects, { buffer = bufnr, mode = "o" }) wk.add(objects)
wk.register(visual, { buffer = bufnr, mode = "x" }) wk.add(visual)

View file

@ -28,7 +28,7 @@ oil.setup({
}) })
local keys = { local keys = {
["-"] = { oil.open, "Open parent directory" }, { "-", oil.open, desc = "Open parent directory" },
} }
wk.register(keys) wk.add(keys)

View file

@ -26,14 +26,12 @@ telescope.load_extension("fzf")
telescope.load_extension("lsp_handlers") telescope.load_extension("lsp_handlers")
local keys = { local keys = {
f = { { "<leader>f", group = "Fuzzy finder" },
name = "Fuzzy finder", { "<leader>fb", telescope_builtin.buffers, desc = "Open buffers" },
b = { telescope_builtin.buffers, "Open buffers" }, { "<leader>ff", telescope_builtin.git_files, desc = "Git tracked files" },
f = { telescope_builtin.git_files, "Git tracked files" }, { "<leader>fF", telescope_builtin.find_files, desc = "Files" },
F = { telescope_builtin.find_files, "Files" }, { "<leader>fg", telescope_builtin.live_grep, desc = "Grep string" },
g = { telescope_builtin.live_grep, "Grep string" }, { "<leader>fG", telescope_builtin.grep_string, desc = "Grep string under cursor" },
G = { telescope_builtin.grep_string, "Grep string under cursor" },
},
} }
wk.register(keys, { prefix = "<leader>" }) wk.add(keys)

View file

@ -1,2 +1,27 @@
local wk = require("which-key") local wk = require("which-key")
wk.setup() wk.setup({
icons = {
-- I don't like icons
mappings = false,
breadcrumb = "»",
separator = "",
group = "+",
ellipsis = "",
keys = {
Up = "",
Down = "",
Left = "",
Right = "",
C = "<C>",
M = "<M>",
D = "<D>",
S = "<S>",
CR = "<CR>",
Esc = "<Esc> ",
NL = "<NL>",
BS = "<BS>",
Space = "<space>",
Tab = "<Tab> ",
},
},
})

View file

@ -14,12 +14,14 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim
wget wget
]; ];
programs = { programs = {
vim.defaultEditor = true; # Modal editing is life vim = {
enable = true;
defaultEditor = true; # Modal editing is life
};
zsh = { zsh = {
enable = true; # Use integrations enable = true; # Use integrations