# HG changeset patch # User zegervdv # Date 1605891670 -3600 # Node ID 10078cb766226a6eda96ac29200817fd128b8b49 # Parent b2c21071a5ef7a3c076901ee0c9f246717429e51 Add treesitter refactor and textobjects plugins Allows to rename variables only within the right scope, based on tree-sitter input diff -r b2c21071a5ef -r 10078cb76622 dot_config/nvim/init.lua --- a/dot_config/nvim/init.lua Sat Nov 14 16:04:54 2020 +0100 +++ b/dot_config/nvim/init.lua Fri Nov 20 18:01:10 2020 +0100 @@ -1,7 +1,6 @@ local lsp = require'nvim_lsp' require "nvim-treesitter.highlight" --- local hlmap = vim.treesitter.TSHighlighter.hl_map require'nvim-treesitter.configs'.setup { highlight = { @@ -32,6 +31,23 @@ }, }, }, + textobjects = { + move = { + enable = true, + goto_next_start = { + ["]]"] = "@block.outer", + }, + goto_previous_start = { + ["[["] = "@block.outer", + }, + goto_next_end = { + ["]["] = "@block.outer", + }, + goto_previous_end = { + ["[]"] = "@block.outer", + }, + }, + }, playground = { enable = true, disable = {}, @@ -43,7 +59,7 @@ local chain_complete_list = { default = { default = { - {complete_items = {'lsp', 'snippet', 'buffer'}}, + {complete_items = {'lsp', 'snippet', 'ts', 'buffer'}}, {complete_items = {'path'}, triggered_only = {'/'}}, {complete_items = {'ts'}}, }, diff -r b2c21071a5ef -r 10078cb76622 dot_config/nvim/init.vim --- a/dot_config/nvim/init.vim Sat Nov 14 16:04:54 2020 +0100 +++ b/dot_config/nvim/init.vim Fri Nov 20 18:01:10 2020 +0100 @@ -109,6 +109,8 @@ Plug 'neovim/nvim-lsp' Plug 'nvim-lua/completion-nvim' Plug 'nvim-treesitter/nvim-treesitter' + Plug 'nvim-treesitter/nvim-treesitter-refactor' + Plug 'nvim-treesitter/nvim-treesitter-textobjects' Plug 'nvim-treesitter/playground' Plug 'steelsojka/completion-buffers' Plug 'nvim-treesitter/completion-treesitter' @@ -464,7 +466,6 @@ " Remap tag-search to better place nnoremap g -nnoremap g nnoremap y g nnoremap @@ -1102,7 +1103,8 @@ augroup ft_systemverilog au! au FileType systemverilog setlocal suffixesadd+=.sv,.v - au FileType systemverilog setlocal foldmethod=marker + au FileType systemverilog setlocal foldmethod=expr + au FileType systemverilog setlocal foldexpr=nvim_treesitter#foldexpr() au FileType systemverilog,verilog call SVAlign() au FileType systemverilog,verilog let b:delimitMate_quotes = "\"" augroup END