fix the whichkey new version

This commit is contained in:
Thitiwat Hemvimon 2024-08-05 10:12:41 +07:00
parent 2c166c6c62
commit 82c18c9988
1 changed files with 26 additions and 18 deletions

View File

@ -5,7 +5,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false vim.g.have_nerd_font = true
-- [[ Setting options ]] -- [[ Setting options ]]
-- See `:help vim.opt` -- See `:help vim.opt`
@ -13,10 +13,10 @@ vim.g.have_nerd_font = false
-- For more options, you can see `:help option-list` -- For more options, you can see `:help option-list`
-- Make line numbers default -- Make line numbers default
vim.opt.number = true -- vim.opt.number = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it! -- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example! -- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
@ -139,6 +139,7 @@ vim.opt.rtp:prepend(lazypath)
-- --
-- NOTE: Here is where you install your plugins. -- NOTE: Here is where you install your plugins.
require('lazy').setup({ require('lazy').setup({
{ 'catppuccin/nvim', name = 'catppuccin', priority = 1000 },
{ {
'zbirenbaum/copilot.lua', 'zbirenbaum/copilot.lua',
cmd = 'Copilot', cmd = 'Copilot',
@ -244,20 +245,26 @@ require('lazy').setup({
config = function() -- This is the function that runs, AFTER loading config = function() -- This is the function that runs, AFTER loading
require('which-key').setup() require('which-key').setup()
-- Document existing key chains require('which-key').add {
require('which-key').register { { '<leader>c', group = '[C]ode' },
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' }, { '<leader>c_', hidden = true },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, { '<leader>d', group = '[D]ocument' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' }, { '<leader>d_', hidden = true },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' }, { '<leader>h', group = 'Git [H]unk' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, { '<leader>h_', hidden = true },
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, { '<leader>r', group = '[R]ename' },
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, { '<leader>r_', hidden = true },
{ '<leader>s', group = '[S]earch' },
{ '<leader>s_', hidden = true },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>t_', hidden = true },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>w_', hidden = true },
}
require('which-key').add {
{ '<leader>h', group = 'Git [H]unk', mode = 'v' },
} }
-- visual mode
require('which-key').register({
['<leader>h'] = { 'Git [H]unk' },
}, { mode = 'v' })
end, end,
}, },
@ -730,7 +737,7 @@ require('lazy').setup({
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
}, },
sources = { sources = {
{ name = 'copilot', group_index = 2 }, { name = 'copilot' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'path' }, { name = 'path' },
@ -750,7 +757,8 @@ require('lazy').setup({
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' -- vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.colorscheme 'catppuccin-frappe'
-- You can configure highlights by doing something like: -- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none' vim.cmd.hi 'Comment gui=none'