# inc-rename.nvim
**Repository Path**: Ziphold/inc-rename.nvim
## Basic Information
- **Project Name**: inc-rename.nvim
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-04-05
- **Last Updated**: 2024-04-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# inc-rename.nvim
A small Neovim plugin that provides a command for LSP renaming with immediate visual
feedback thanks to Neovim's command preview feature.
## Installation
**This plugin requires at least Neovim 0.8**
Install using your favorite package manager and call the `setup` function.
lazy.nvim
```lua
{
"smjonas/inc-rename.nvim",
config = function()
require("inc_rename").setup()
end,
}
```
packer.nvim
```lua
use {
"smjonas/inc-rename.nvim",
config = function()
require("inc_rename").setup()
end,
}
```
vim-plug
```vim
Plug 'smjonas/inc-rename.nvim'
```
Somewhere in your init.lua, you will need to call the setup function:
```lua
require("inc_rename").setup()
```
## Usage
Simply type `:IncRename ` while your cursor is on an LSP identifier.
You could also create a keymap that types out the command name for you so you only have to
enter the new name:
```lua
vim.keymap.set("n", "rn", ":IncRename ")
```
If you want to fill in the word under the cursor you can use the following:
```lua
vim.keymap.set("n", "rn", function()
return ":IncRename " .. vim.fn.expand("")
end, { expr = true })
```
💥 noice.nvim support
If you are using [noice.nvim](https://github.com/folke/noice.nvim), you can enable the `inc_rename` preset like this:
```lua
require("noice").setup {
presets = { inc_rename = true }
}
```
Then simply type the `:IncRename` command (or use the keymap mentioned above).
🌸 dressing.nvim support
If you are using [dressing.nvim](https://github.com/stevearc/dressing.nvim),
set the `input_buffer_type` option to `"dressing"`:
```lua
require("inc_rename").setup {
input_buffer_type = "dressing",
}
```
Then simply type the `:IncRename` command and the new name you enter will automatically be updated in the input buffer as you type.
The result should look something like this:
> :bulb: Tip - try these `dressing.nvim` settings to position the input box above the
> cursor to not cover the word being renamed (thank you
> [@RaafatTurki](https://github.com/RaafatTurki) for the suggestion!):
```lua
require("dressing").setup {
input = {
override = function(conf)
conf.col = -1
conf.row = 0
return conf
end,
},
}
```
## Known issues
There have been reports of `inc-rename` not working with certain plugins and language servers:
- `traces.vim` (see [issue #35](https://github.com/smjonas/inc-rename.nvim/issues/35))
- `custom-elements-languageserver` (see [issue #44](https://github.com/smjonas/inc-rename.nvim/issues/44))
Make sure to uninstall these if you are experiencing issues.
## Customization
You can override the default settings by passing a Lua table to the `setup` function.
The default options are:
```lua
require("inc_rename").setup {
cmd_name = "IncRename", -- the name of the command
hl_group = "Substitute", -- the highlight group used for highlighting the identifier's new name
preview_empty_name = false, -- whether an empty new name should be previewed; if false the command preview will be cancelled instead
show_message = true, -- whether to display a `Renamed m instances in n files` message after a rename operation
input_buffer_type = nil, -- the type of the external input buffer to use (the only supported value is currently "dressing")
post_hook = nil, -- callback to run after renaming, receives the result table (from LSP handler) as an argument
}
```