update: nvim: add tree-sitter
This commit is contained in:
parent
009a5f1e83
commit
3875bb2a74
1 changed files with 28 additions and 2 deletions
|
@ -33,10 +33,14 @@ require('lazy').setup({
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'hrsh7th/cmp-nvim-lsp', -- LSP
|
'hrsh7th/cmp-nvim-lsp', -- LSP
|
||||||
'L3MON4D3/LuaSnip', -- snippets
|
'L3MON4D3/LuaSnip', -- snippets
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip
|
||||||
'kdheepak/cmp-latex-symbols', -- latex math
|
'kdheepak/cmp-latex-symbols', -- latex math
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +98,28 @@ end
|
||||||
-- lualine
|
-- lualine
|
||||||
require('lualine_setup')
|
require('lualine_setup')
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
-- Treesitter
|
||||||
|
-- manually install parsers with `:TSInstall <language>`
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "gnn",
|
||||||
|
node_incremental = "grn",
|
||||||
|
scope_incremental = "grc",
|
||||||
|
node_decremental = "grm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-- LSP config
|
-- LSP config
|
||||||
|
|
||||||
|
@ -129,7 +155,7 @@ local on_attach = function(client, bufnr)
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue