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

View file

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

View file

@ -1,7 +1,7 @@
local wk = require("which-key")
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 keys = {
-- Edition and navigation mappins
["["] = {
name = "Previous",
["<space>"] = "Insert blank line above",
["<C-L>"] = "Previous location list file",
["<C-Q>"] = "Previous quickfix list file",
["<C-T>"] = "Previous tag in preview window",
a = "Previous argument",
A = "First argument",
b = "Previous buffer",
B = "First buffer",
e = "Exchange previous line",
f = "Previous file in directory",
l = "Previous location list entry",
L = "First Location list entry",
n = "Previous conflict marker/diff hunk",
p = "Paste line above",
P = "Paste line above",
q = "Previous quickfix list entry",
Q = "First quickfix list entry",
t = "Previous matching tag",
T = "First matching tag",
z = "Previous fold",
-- Encoding
C = "C string encode",
u = "URL encode",
x = "XML encode",
y = "C string encode",
-- Custom
d = { lsp.goto_prev_diagnostic, "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" },
},
-- Previous
{ "[", group = "Previous" },
-- Edition and navigation mappings
{ "[<space>", desc = "Insert blank line above" },
{ "[<C-L>", desc = "Previous location list file" },
{ "[<C-Q>", desc = "Previous quickfix list file" },
{ "[<C-T>", desc = "Previous tag in preview window" },
{ "[a", desc = "Previous argument" },
{ "[A", desc = "First argument" },
{ "[b", desc = "Previous buffer" },
{ "[B", desc = "First buffer" },
{ "[e", desc = "Exchange previous line" },
{ "[f", desc = "Previous file in directory" },
{ "[l", desc = "Previous location list entry" },
{ "[L", desc = "First Location list entry" },
{ "[n", desc = "Previous conflict marker/diff hunk" },
{ "[p", desc = "Paste line above" },
{ "[P", desc = "Paste line above" },
{ "[q", desc = "Previous quickfix list entry" },
{ "[Q", desc = "First quickfix list entry" },
{ "[t", desc = "Previous matching tag" },
{ "[T", desc = "First matching tag" },
{ "[z", desc = "Previous fold" },
-- Encoding
{ "[C", desc = "C string encode" },
{ "[u", desc = "URL encode" },
{ "[x", desc = "XML encode" },
{ "[y", desc = "C string encode" },
-- Custom
{ "[d", lsp.goto_prev_diagnostic, desc = "Previous diagnostic" },
-- Option mappings
["[o"] = {
name = "Enable option",
b = "Light background",
c = "Cursor line",
d = "Diff",
f = { "<cmd>FormatEnable<CR>", "LSP Formatting" },
h = "Search high-lighting",
i = "Case insensitive search",
l = "List mode",
n = "Line numbers",
r = "Relative line numbers",
p = { "<cmd>lwindow<CR>", "Location list" },
q = { "<cmd>cwindow<CR>", "Quickfix list" },
u = "Cursor column",
v = "Virtual editing",
w = "Text wrapping",
x = "Cursor line and column",
z = "Spell checking",
},
["]o"] = {
name = "Disable option",
b = "Light background",
c = "Cursor line",
d = "Diff",
f = { "<cmd>FormatDisable<CR>", "LSP Formatting" },
h = "Search high-lighting",
i = "Case insensitive search",
l = "List mode",
n = "Line numbers",
p = { "<cmd>lclose<CR>", "Location list" },
q = { "<cmd>cclose<CR>", "Quickfix list" },
r = "Relative line numbers",
u = "Cursor column",
v = "Virtual editing",
w = "Text wrapping",
x = "Cursor line and column",
z = "Spell checking",
},
["yo"] = {
name = "Toggle option",
b = "Light background",
c = "Cursor line",
d = "Diff",
f = { "<cmd>FormatToggle<CR>", "LSP Formatting" },
h = "Search high-lighting",
i = "Case insensitive search",
l = "List mode",
n = "Line numbers",
p = { "<Plug>(qf_loc_toggle)", "Location list" },
q = { "<Plug>(qf_qf_toggle)", "Quickfix list" },
r = "Relative line numbers",
u = "Cursor column",
v = "Virtual editing",
w = "Text wrapping",
x = "Cursor line and column",
z = "Spell checking",
},
-- Next
{ "]", group = "Next" },
-- Edition and navigation mappings
{ "]<space>", desc = "Insert blank line below" },
{ "]<C-L>", desc = "Next location list file" },
{ "]<C-Q>", desc = "Next quickfix list file" },
{ "]<C-T>", desc = "Next tag in preview window" },
{ "]a", desc = "Next argument" },
{ "]A", desc = "Last argument" },
{ "]b", desc = "Next buffer" },
{ "]B", desc = "Last buffer" },
{ "]e", desc = "Exchange next line" },
{ "]f", desc = "Next file in directory" },
{ "]l", desc = "Next location list entry" },
{ "]L", desc = "Last Location list entry" },
{ "]n", desc = "Next conflict marker/diff hunk" },
{ "]p", desc = "Paste line below" },
{ "]P", desc = "Paste line below" },
{ "]q", desc = "Next quickfix list entry" },
{ "]Q", desc = "Last quickfix list entry" },
{ "]t", desc = "Next matching tag" },
{ "]T", desc = "Last matching tag" },
{ "]z", desc = "Next fold" },
-- Decoding
{ "]C", desc = "C string decode" },
{ "]u", desc = "URL decode" },
{ "]x", desc = "XML decode" },
{ "]y", desc = "C string decode" },
-- Custom
{ "]d", lsp.goto_next_diagnostic, desc = "Next diagnostic" },
-- Enable option
{ "[o", desc = "Enable option" },
{ "[ob", desc = "Light background" },
{ "[oc", desc = "Cursor line" },
{ "[od", desc = "Diff" },
{ "[of", "<cmd>FormatEnable<CR>", desc = "LSP Formatting" },
{ "[oh", desc = "Search high-lighting" },
{ "[oi", desc = "Case insensitive search" },
{ "[ol", desc = "List mode" },
{ "[on", desc = "Line numbers" },
{ "[or", desc = "Relative line numbers" },
{ "[op", "<cmd>lwindow<CR>", desc = "Location list" },
{ "[oq", "<cmd>cwindow<CR>", desc = "Quickfix list" },
{ "[ou", desc = "Cursor column" },
{ "[ov", desc = "Virtual editing" },
{ "[ow", desc = "Text wrapping" },
{ "[ox", desc = "Cursor line and column" },
{ "[oz", desc = "Spell checking" },
-- Disable option
{ "]o", desc = "Disable option" },
{ "]ob", desc = "Light background" },
{ "]oc", desc = "Cursor line" },
{ "]od", desc = "Diff" },
{ "]of", "<cmd>FormatDisable<CR>", desc = "LSP Formatting" },
{ "]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
local keys = {
K = { vim.lsp.buf.hover, "Show symbol information" },
["<C-k>"] = { vim.lsp.buf.signature_help, "Show signature information" },
["gd"] = { vim.lsp.buf.definition, "Go to definition" },
["gD"] = { vim.lsp.buf.declaration, "Go to declaration" },
["gi"] = { vim.lsp.buf.implementation, "Go to implementation" },
["gr"] = { vim.lsp.buf.references, "List all references" },
["<leader>c"] = {
name = "Code",
a = { vim.lsp.buf.code_action, "Code actions" },
d = { cycle_diagnostics_display, "Cycle diagnostics display" },
D = { show_buffer_diagnostics, "Show buffer diagnostics" },
r = { vim.lsp.buf.rename, "Rename symbol" },
s = { vim.lsp.buf.signature_help, "Show signature" },
t = { vim.lsp.buf.type_definition, "Go to type definition" },
w = {
name = "Workspace",
a = { vim.lsp.buf.add_workspace_folder, "Add folder to workspace" },
l = { list_workspace_folders, "List folders in workspace" },
r = { vim.lsp.buf.remove_workspace_folder, "Remove folder from workspace" },
},
},
buffer = bufnr,
-- LSP navigation
{ "K", vim.lsp.buf.hover, desc = "Show symbol information" },
{ "<C-k>", vim.lsp.buf.signature_help, desc = "Show signature information" },
{ "gd", vim.lsp.buf.definition, desc = "Go to definition" },
{ "gD", vim.lsp.buf.declaration, desc = "Go to declaration" },
{ "gi", vim.lsp.buf.implementation, desc = "Go to implementation" },
{ "gr", vim.lsp.buf.references, desc = "List all references" },
-- Code
{ "<leader>c", group = "Code" },
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code actions" },
{ "<leader>cd", cycle_diagnostics_display, desc = "Cycle diagnostics display" },
{ "<leader>cD", show_buffer_diagnostics, desc = "Show buffer diagnostics" },
{ "<leader>cr", vim.lsp.buf.rename, desc = "Rename symbol" },
{ "<leader>cs", vim.lsp.buf.signature_help, desc = "Show signature" },
{ "<leader>ct", vim.lsp.buf.type_definition, desc = "Go to type definition" },
-- Workspace
{ "<leader>cw", group = "Workspace" },
{ "<leader>cwa", vim.lsp.buf.add_workspace_folder, desc = "Add folder to 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
return M

View file

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

View file

@ -28,7 +28,7 @@ oil.setup({
})
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")
local keys = {
f = {
name = "Fuzzy finder",
b = { telescope_builtin.buffers, "Open buffers" },
f = { telescope_builtin.git_files, "Git tracked files" },
F = { telescope_builtin.find_files, "Files" },
g = { telescope_builtin.live_grep, "Grep string" },
G = { telescope_builtin.grep_string, "Grep string under cursor" },
},
{ "<leader>f", group = "Fuzzy finder" },
{ "<leader>fb", telescope_builtin.buffers, desc = "Open buffers" },
{ "<leader>ff", telescope_builtin.git_files, desc = "Git tracked files" },
{ "<leader>fF", telescope_builtin.find_files, desc = "Files" },
{ "<leader>fg", telescope_builtin.live_grep, desc = "Grep string" },
{ "<leader>fG", telescope_builtin.grep_string, desc = "Grep string under cursor" },
}
wk.register(keys, { prefix = "<leader>" })
wk.add(keys)

View file

@ -1,2 +1,27 @@
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 {
environment.systemPackages = with pkgs; [
vim
wget
];
programs = {
vim.defaultEditor = true; # Modal editing is life
vim = {
enable = true;
defaultEditor = true; # Modal editing is life
};
zsh = {
enable = true; # Use integrations