Nvim treesitter refactor
Refactor module for nvim-treesitter
Refactor modules for [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) The project is written primarily in Lua, distributed under the Apache License 2.0 license, first published in 2020. Key topics include: hacktoberfest, nvim-treesitter.
nvim-treesitter-refactor
Refactor modules for nvim-treesitter
[!CAUTION]
This plugin is deprecated because it is not compatible with the maintained nvim-treesittermainbranch.
See https://github.com/nvim-treesitter/nvim-treesitter-locals for a replacement.
Installation
You can install nvim-treesitter-refactor with your favorite package manager,
or using the default pack feature of Neovim!
Note: This plugin requires nvim-treesitter installed.
Using a package manager
If you are using vim-plug, put this in your init.vim file:
vimPlug 'nvim-treesitter/nvim-treesitter-refactor'
Highlight definitions
Highlights definition and usages of the current symbol under the cursor.
lualua <<EOF require'nvim-treesitter.configs'.setup { refactor = { highlight_definitions = { enable = true, -- Set to false if you have an `updatetime` of ~100. clear_on_cursor_move = true, }, }, } EOF
Highlight current scope
Highlights the block from the current scope where the cursor is.
lualua <<EOF require'nvim-treesitter.configs'.setup { refactor = { highlight_current_scope = { enable = true }, }, } EOF
Smart rename
Renames the symbol under the cursor within the current scope (and current file).
lualua <<EOF require'nvim-treesitter.configs'.setup { refactor = { smart_rename = { enable = true, -- Assign keymaps to false to disable them, e.g. `smart_rename = false`. keymaps = { smart_rename = "grr", }, }, }, } EOF
Navigation
Provides "go to definition" for the symbol under the cursor,
and lists the definitions from the current file. If you use
goto_definition_lsp_fallback instead of goto_definition in the config below
vim.lsp.buf.definition is used if nvim-treesitter can not resolve the variable.
goto_next_usage/goto_previous_usage go to the next usage of the identifier under the cursor.
lualua <<EOF require'nvim-treesitter.configs'.setup { refactor = { navigation = { enable = true, -- Assign keymaps to false to disable them, e.g. `goto_definition = false`. keymaps = { goto_definition = "gnd", list_definitions = "gnD", list_definitions_toc = "gO", goto_next_usage = "<a-*>", goto_previous_usage = "<a-#>", }, }, }, } EOF
Contributors
Showing top 11 contributors by commit count.
