mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-12-26 21:31:45 +00:00
Merge pull request #448 from AshrafMichail23/main
Defer Treesitter setup to improve startup time of nvim {filename}
This commit is contained in:
commit
f15af9b8be
109
init.lua
109
init.lua
@ -321,69 +321,72 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
|
|||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
-- [[ Configure Treesitter ]]
|
||||||
-- See `:help nvim-treesitter`
|
-- See `:help nvim-treesitter`
|
||||||
require('nvim-treesitter.configs').setup {
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
vim.defer_fn(function()
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
require('nvim-treesitter.configs').setup {
|
||||||
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
|
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = '<c-space>',
|
|
||||||
node_incremental = '<c-space>',
|
|
||||||
scope_incremental = '<c-s>',
|
|
||||||
node_decremental = '<M-space>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
enable = true,
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
keymaps = {
|
keymaps = {
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
init_selection = '<c-space>',
|
||||||
['aa'] = '@parameter.outer',
|
node_incremental = '<c-space>',
|
||||||
['ia'] = '@parameter.inner',
|
scope_incremental = '<c-s>',
|
||||||
['af'] = '@function.outer',
|
node_decremental = '<M-space>',
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
move = {
|
textobjects = {
|
||||||
enable = true,
|
select = {
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
enable = true,
|
||||||
goto_next_start = {
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
[']m'] = '@function.outer',
|
keymaps = {
|
||||||
[']]'] = '@class.outer',
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
['aa'] = '@parameter.outer',
|
||||||
|
['ia'] = '@parameter.inner',
|
||||||
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
goto_next_end = {
|
move = {
|
||||||
[']M'] = '@function.outer',
|
enable = true,
|
||||||
[']['] = '@class.outer',
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
|
goto_next_start = {
|
||||||
|
[']m'] = '@function.outer',
|
||||||
|
[']]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
[']M'] = '@function.outer',
|
||||||
|
[']['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
['[m'] = '@function.outer',
|
||||||
|
['[['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
['[M'] = '@function.outer',
|
||||||
|
['[]'] = '@class.outer',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
goto_previous_start = {
|
swap = {
|
||||||
['[m'] = '@function.outer',
|
enable = true,
|
||||||
['[['] = '@class.outer',
|
swap_next = {
|
||||||
},
|
['<leader>a'] = '@parameter.inner',
|
||||||
goto_previous_end = {
|
},
|
||||||
['[M'] = '@function.outer',
|
swap_previous = {
|
||||||
['[]'] = '@class.outer',
|
['<leader>A'] = '@parameter.inner',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
swap = {
|
}
|
||||||
enable = true,
|
end, 0)
|
||||||
swap_next = {
|
|
||||||
['<leader>a'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
['<leader>A'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
Loading…
Reference in New Issue
Block a user