Skip to content

Commit

Permalink
cleanup: refactor which-key configuration for cleaner setup (nvim-lua…
Browse files Browse the repository at this point in the history
…#1102)

- Moved `which-key` configuration from inline `config` to `opts` for better organization.
- Updated the key mappings setup to use `spec` for defining existing key chains.
- Removed deprecated or unnecessary comments and code.

This change aligns with updated `which-key` configuration practices, improving readability and maintainability as recommended by @VlaDexa in nvim-lua#1068.
  • Loading branch information
iton0 authored and Fernando committed Dec 26, 2024
1 parent 9497f99 commit a88651f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ require('lazy').setup({
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Expand Down Expand Up @@ -316,17 +316,17 @@ require('lazy').setup({
F11 = '<F11>',
F12 = '<F12>',
},
},

-- Document existing key chains
spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[F]ind' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
-- Document existing key chains
spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},
},
},
Expand Down

0 comments on commit a88651f

Please sign in to comment.