Skip to content

Commit d4b6378

Browse files
iton0LoganSchmalz
authored andcommitted
refactor: update treesitter and which-key config (nvim-lua#1068)
1 parent dcc135b commit d4b6378

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 {
@@ -846,6 +883,8 @@ require('lazy').setup({
846883
{ -- Highlight, edit, and navigate code
847884
'nvim-treesitter/nvim-treesitter',
848885
build = ':TSUpdate',
886+
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
887+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
849888
opts = {
850889
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
851890
-- Autoinstall languages that are not installed
@@ -859,19 +898,12 @@ require('lazy').setup({
859898
},
860899
indent = { enable = true, disable = { 'ruby' } },
861900
},
862-
config = function(_, opts)
863-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
864-
865-
---@diagnostic disable-next-line: missing-fields
866-
require('nvim-treesitter.configs').setup(opts)
867-
868-
-- There are additional nvim-treesitter modules that you can use to interact
869-
-- with nvim-treesitter. You should go explore a few and see what interests you:
870-
--
871-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
872-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
873-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
874-
end,
901+
-- There are additional nvim-treesitter modules that you can use to interact
902+
-- with nvim-treesitter. You should go explore a few and see what interests you:
903+
--
904+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
905+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
906+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
875907
},
876908

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

0 commit comments

Comments
 (0)