# inc-rename.nvim renames through Neovim's own command preview

> inc-rename.nvim is a small Neovim plugin that turns the LSP rename into a live preview driven by the editor's command preview, so you see every affected occurrence update as you type the new name.

**smjonas/inc-rename.nvim** — Incremental LSP renaming based on Neovim's command-preview feature.

- Repository: https://github.com/smjonas/inc-rename.nvim
- Stars: 860 · Forks: 20
- Language: Lua
- License: MIT
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/smjonas-inc-rename-nvim

## The rename preview is Neovim's command preview, not a custom UI

The plugin is described as providing a command for LSP renaming with immediate visual feedback thanks to Neovim's command preview feature. That detail is the whole architecture. Rather than drawing its own floating window or hijacking the message area, inc-rename.nvim uses the mechanism Neovim provides for previewing the result of a command as you type it, so the buffer behind the prompt shows the renamed identifier updating live. The consequence is that what you see is the editor's own preview rendering, which is also why the plugin needs a recent enough editor: the README states that the plugin requires at least Neovim 0.8. The audience is narrow and clear, Neovim users with an LSP client configured, who want a rename to feel continuous rather than modal.

## Installation is a plugin spec plus one setup call

The plugin is installed with your package manager of choice and then configured by calling the setup function. With lazy.nvim the spec is minimal.

```lua
{
  "smjonas/inc-rename.nvim",
  opts = {}
}
```

With packer.nvim the setup call goes inside the config function.

```lua
use {
  "smjonas/inc-rename.nvim",
  config = function()
    require("inc_rename").setup()
  end,
}
```

For vim-plug, the plugin line is added to the plugin list and the setup call has to be placed somewhere in your init.lua.

```vim
Plug 'smjonas/inc-rename.nvim'
```

```lua
require("inc_rename").setup()
```

The pattern is the same in all three cases. The plugin declares a command and needs one setup call, and the repository root is minimal, with lua/ holding the plugin code, tests/ holding the test suite, a .stylua.toml for formatting, and a LICENSE file. The licence is MIT.

## The IncRename command and the two keymap shapes

In normal use you type the command with the new name while the cursor sits on an identifier that the language server understands.

```
:IncRename <new_name>
```

The README also suggests keymaps that type the command name for you, so you only enter the new name. A plain mapping inserts the command prefix.

```lua
vim.keymap.set("n", "<leader>rn", ":IncRename ")
```

The more useful variant pre-fills the word under the cursor, so the current name appears in the prompt ready to be edited rather than deleted and retyped.

```lua
vim.keymap.set("n", "<leader>rn", function()
  return ":IncRename " .. vim.fn.expand("<cword>")
end, { expr = true })
```

The expr option is what makes the function form work, since the mapping has to return the text to insert rather than execute a sequence of normal mode commands.

## The setup options are the real configuration surface

Passing a Lua table to setup overrides the defaults, and the README lists them. The first group controls what the plugin does and shows.

```lua
require("inc_rename").setup {
 -- the name of the command
  cmd_name = "IncRename",
   -- the highlight group used for highlighting the identifier's new name
  hl_group = "Substitute",
   -- whether an empty new name should be previewed; if false the command preview will be cancelled instead
  preview_empty_name = false,
   -- whether to display a `Renamed m instances in n files` message after a rename operation
  show_message = true,
```

The second group covers the input buffer and the history behaviour.

```lua
   -- whether to save the "IncRename" command in the commandline history (set to false to prevent issues with
   -- navigating to older entries that may arise due to the behavior of command preview)
  save_in_cmdline_history = true,
   -- the type of the external input buffer to use (currently supports "dressing" or "snacks")
  input_buffer_type = nil,
   -- callback to run after renaming, receives the result table (from LSP handler) as an argument
  post_hook = nil,
}
```

Two of these deserve attention. The comment on save_in_cmdline_history is a warning that the command preview behaviour interferes with navigating to older command line entries, so the fix for anyone who hits that is to set it to false. And post_hook gives you a callback that receives the result table from the LSP handler, which is the hook to use if you want to run something after a rename, such as a format or a test, without reaching into the plugin internals.

## External input buffers are an option, not an assumption

The default experience uses the editor's own input, but the plugin can delegate the prompt to a third party input buffer, and there are three documented integrations. With noice.nvim, enabling the preset is enough.

```lua
require("noice").setup {
  presets = { inc_rename = true }
}
```

With dressing.nvim you set the input_buffer_type option to "dressing", and the README notes that the new name you enter is then automatically updated in the input buffer as you type. With snacks.nvim, the same option is set to "snacks", and that plugin's input feature has to be enabled first. The dressing integration also comes with a tip for positioning the input box above the cursor so it does not cover the word being renamed, using an override function that sets conf.col to -1 and conf.row to 0. Setting input_buffer_type to nil, the default, keeps the built-in behaviour.

## Renames that span files need saved buffers and inccommand

A cross-file rename has a precondition that catches people out. The README says that when renaming across multiple files you must save all affected buffers with :wa, because the preview only shows changes in buffers that are on disk. The Neovim option inccommand set to split, with :set inccommand=split, makes Neovim show a buffer containing information about all identifiers to be renamed as you type, and :set cmdwinheight=20 changes the height of that preview window. The plugin also decides whether to show a summary message afterwards, controlled by show_message, and the default message format in the option comment is a Renamed m instances in n files line. So the visible feedback has two layers: the live preview in your buffer, and an optional count of what changed.

## Two plugins are known to break the rename

The README keeps a known issues section, and it is short and specific. There have been reports of inc-rename not working with certain plugins and language servers: traces.vim, tracked in issue 35, and custom-elements-languageserver, tracked in issue 44. The advice is to uninstall those if you are experiencing issues. That is a fair summary of what is known, and it also reveals the shape of the risk. The plugin sits between the editor's command line and the language server, so any other plugin that also intercepts either of those can interfere with it. This is the failure mode to expect: not that the plugin stops working entirely, but that in a particular project with a particular combination of tools, the rename silently does not produce the preview. If you hit it, the two named plugins are the first thing to try disabling.

## Conclusion

inc-rename.nvim suits a Neovim user on Neovim 0.8 or newer who renames identifiers often and finds the normal LSP rename dialog too abrupt, and it suits anyone who wants the affected occurrences visible while typing rather than after confirming. It is the wrong tool if you work in a buffer that is not under LSP control, since the rename depends on a language server resolving the symbol, and it is the wrong tool if you are on a Neovim older than 0.8, where the command preview feature the plugin is built on does not exist. Before adopting it, run :IncRename on a symbol to see whether your language server accepts the rename request, check the two known incompatibilities, traces.vim and custom-elements-languageserver, and set save_in_cmdline_history to false if you rely on recalling older IncRename entries. The last push was on 2026-07-30, and the repository publishes no GitHub releases.

## FAQ

### How do I install inc-rename.nvim in Neovim?

Install it with your package manager and call the setup function. The README shows specs for lazy.nvim, packer.nvim and vim-plug, and the plugin requires at least Neovim 0.8.

### How do I use the inc-rename.nvim rename command?

Type :IncRename followed by the new name while the cursor is on an LSP identifier. The README also suggests keymaps that insert the command name, one of which pre-fills the word under the cursor using vim.fn.expand("<cword>").

### Which plugins are known to conflict with inc-rename.nvim?

The README names traces.vim and custom-elements-languageserver, pointing to issue 35 and issue 44 respectively, and suggests uninstalling them if the rename does not work.

### What do I need to do before renaming across multiple files with inc-rename.nvim?

The README says to save all affected buffers with :wa first. Setting the Neovim option inccommand to split shows a buffer with information about all identifiers to be renamed as you type.

### How can I use a third party input buffer with inc-rename.nvim?

The input_buffer_type setup option currently supports dressing and snacks, and the README documents a noice.nvim preset called inc_rename. With dressing or snacks the new name is updated in the input buffer as you type.

## Sources

- [Issues](https://github.com/smjonas/inc-rename.nvim/issues)
- [License: MIT](https://github.com/smjonas/inc-rename.nvim/blob/main/LICENSE)
- [README](https://github.com/smjonas/inc-rename.nvim/blob/main/README.md)
- [smjonas/inc-rename.nvim on GitHub](https://github.com/smjonas/inc-rename.nvim)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/smjonas-inc-rename-nvim
