Neovim for Beginners — Refactoring

Code refactoring using Neovim.

alpha2phi
7 min readApr 23, 2022
Neovim for Beginners — Refactoring

Code refactoring is one key feature of using an IDE. Natively Vim as a text editor does not have any built-in support for code refactoring.

With Neovim we start to have the built-in LSP support that gives us basic code refactoring features like find-references, rename, code actions, etc., using semantic whole-project analysis. In this article, we are going to

  • Use Neovim to search and replace a pattern in multiple buffers.
  • Explore plugins to help in search and replace.
  • Explore LSP code refactoring features.
  • Explore plugins for code refactoring.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Search and Replace in Multiple Buffers

There are multiple ways to search and replace a pattern in multiple buffers. We can use the commands listed below to search and replace a pattern in multiple buffers.

  • :argdo — Execute the command for each file in the argument list
  • :bufdo — Execute the command in each buffer in the buffer list

--

--

alpha2phi
alpha2phi

Written by alpha2phi

Software engineer, Data Science and ML practitioner.

Responses (2)