Add config for treesitter extensions & setup playground

This commit is contained in:
Salar Rahmanian 2021-07-14 23:28:30 -07:00
parent 74475c8793
commit bf88d45a58

View file

@ -10,6 +10,7 @@ local function load_plugins()
require('packer').startup(function()
use 'wbthomason/packer.nvim' -- Package manager
use 'nvim-treesitter/nvim-treesitter'
use 'nvim-treesitter/nvim-treesitter-textobjects'
use 'folke/which-key.nvim'
use 'tpope/vim-commentary' -- "gc" to comment visual regions/lines
use {'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} }
@ -28,6 +29,7 @@ local function load_plugins()
use 'scalameta/nvim-metals'
use 'ray-x/lsp_signature.nvim'
use { 'folke/trouble.nvim', requires = 'kyazdani42/nvim-web-devicons' }
use 'nvim-treesitter/playground'
end)
end
@ -40,7 +42,7 @@ _G.load_config = function()
require("salargalaxyline")
-- Treesitter
require("nvim-treesitter.configs").setup({
require('nvim-treesitter.configs').setup {
playground = { enable = true },
query_linter = {
enable = true,
@ -49,7 +51,70 @@ _G.load_config = function()
},
ensure_installed = "maintained",
highlight = { enable = true },
})
incremental_selection = {
enable = true,
keymaps = {
init_selection = 'gnn',
node_incremental = 'grn',
scope_incremental = 'grc',
node_decremental = 'grm',
},
},
indent = {
enable = true,
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
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',
},
},
},
playground = {
enable = true,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<cr>',
show_help = '?',
},
}
}
-- neogit
require('neogit').setup({