Skip to content

Commit bb1d33c

Browse files
iton0monk3yd
authored andcommitted
refactor: update treesitter and which-key config (nvim-lua#1068)
1 parent d13ae98 commit bb1d33c

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
@@ -347,7 +347,44 @@ require('lazy').setup({
347347
'folke/which-key.nvim',
348348
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
349349
config = function() -- This is the function that runs, AFTER loading
350-
require('which-key').setup()
350+
require('which-key').setup {
351+
icons = {
352+
-- set icon mappings to true if you have a Nerd Font
353+
mappings = vim.g.have_nerd_font,
354+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
355+
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
356+
keys = vim.g.have_nerd_font and {} or {
357+
Up = '<Up> ',
358+
Down = '<Down> ',
359+
Left = '<Left> ',
360+
Right = '<Right> ',
361+
C = '<C-…> ',
362+
M = '<M-…> ',
363+
D = '<D-…> ',
364+
S = '<S-…> ',
365+
CR = '<CR> ',
366+
Esc = '<Esc> ',
367+
ScrollWheelDown = '<ScrollWheelDown> ',
368+
ScrollWheelUp = '<ScrollWheelUp> ',
369+
NL = '<NL> ',
370+
BS = '<BS> ',
371+
Space = '<Space> ',
372+
Tab = '<Tab> ',
373+
F1 = '<F1>',
374+
F2 = '<F2>',
375+
F3 = '<F3>',
376+
F4 = '<F4>',
377+
F5 = '<F5>',
378+
F6 = '<F6>',
379+
F7 = '<F7>',
380+
F8 = '<F8>',
381+
F9 = '<F9>',
382+
F10 = '<F10>',
383+
F11 = '<F11>',
384+
F12 = '<F12>',
385+
},
386+
},
387+
}
351388

352389
-- Document existing key chains
353390
require('which-key').add {
@@ -922,6 +959,8 @@ require('lazy').setup({
922959
{ -- Highlight, edit, and navigate code
923960
'nvim-treesitter/nvim-treesitter',
924961
build = ':TSUpdate',
962+
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
963+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
925964
opts = {
926965
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
927966
-- Autoinstall languages that are not installed
@@ -935,19 +974,12 @@ require('lazy').setup({
935974
},
936975
indent = { enable = true, disable = { 'ruby' } },
937976
},
938-
config = function(_, opts)
939-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
940-
941-
---@diagnostic disable-next-line: missing-fields
942-
require('nvim-treesitter.configs').setup(opts)
943-
944-
-- There are additional nvim-treesitter modules that you can use to interact
945-
-- with nvim-treesitter. You should go explore a few and see what interests you:
946-
--
947-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
948-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
949-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
950-
end,
977+
-- There are additional nvim-treesitter modules that you can use to interact
978+
-- with nvim-treesitter. You should go explore a few and see what interests you:
979+
--
980+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
981+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
982+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
951983
},
952984

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

0 commit comments

Comments
 (0)