Skip to content

Commit d4e0b3b

Browse files
restrayTimothée Belhomme
authored and
Timothée Belhomme
committed
refactor: update treesitter and which-key config (nvim-lua#1068)
1 parent b50285f commit d4e0b3b

File tree

1 file changed

+46
-14
lines changed

1 file changed

+46
-14
lines changed

init.lua

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,44 @@ require('lazy').setup({
275275
'folke/which-key.nvim',
276276
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
277277
config = function() -- This is the function that runs, AFTER loading
278-
require('which-key').setup()
278+
require('which-key').setup {
279+
icons = {
280+
-- set icon mappings to true if you have a Nerd Font
281+
mappings = vim.g.have_nerd_font,
282+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
283+
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
284+
keys = vim.g.have_nerd_font and {} or {
285+
Up = '<Up> ',
286+
Down = '<Down> ',
287+
Left = '<Left> ',
288+
Right = '<Right> ',
289+
C = '<C-…> ',
290+
M = '<M-…> ',
291+
D = '<D-…> ',
292+
S = '<S-…> ',
293+
CR = '<CR> ',
294+
Esc = '<Esc> ',
295+
ScrollWheelDown = '<ScrollWheelDown> ',
296+
ScrollWheelUp = '<ScrollWheelUp> ',
297+
NL = '<NL> ',
298+
BS = '<BS> ',
299+
Space = '<Space> ',
300+
Tab = '<Tab> ',
301+
F1 = '<F1>',
302+
F2 = '<F2>',
303+
F3 = '<F3>',
304+
F4 = '<F4>',
305+
F5 = '<F5>',
306+
F6 = '<F6>',
307+
F7 = '<F7>',
308+
F8 = '<F8>',
309+
F9 = '<F9>',
310+
F10 = '<F10>',
311+
F11 = '<F11>',
312+
F12 = '<F12>',
313+
},
314+
},
315+
}
279316

280317
-- Document existing key chains
281318
require('which-key').add {
@@ -843,6 +880,8 @@ require('lazy').setup({
843880
{ -- Highlight, edit, and navigate code
844881
'nvim-treesitter/nvim-treesitter',
845882
build = ':TSUpdate',
883+
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
884+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
846885
opts = {
847886
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
848887
-- Autoinstall languages that are not installed
@@ -856,19 +895,12 @@ require('lazy').setup({
856895
},
857896
indent = { enable = true, disable = { 'ruby' } },
858897
},
859-
config = function(_, opts)
860-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
861-
862-
---@diagnostic disable-next-line: missing-fields
863-
require('nvim-treesitter.configs').setup(opts)
864-
865-
-- There are additional nvim-treesitter modules that you can use to interact
866-
-- with nvim-treesitter. You should go explore a few and see what interests you:
867-
--
868-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
869-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
870-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
871-
end,
898+
-- There are additional nvim-treesitter modules that you can use to interact
899+
-- with nvim-treesitter. You should go explore a few and see what interests you:
900+
--
901+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
902+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
903+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
872904
},
873905

874906
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the

0 commit comments

Comments
 (0)