DEV Community

Cover image for Preview replace results in Neovim
Konstantin
Konstantin

Posted on

6

Preview replace results in Neovim

There is an interesting option in Neovim called inccommand. It allows you see the live preview of your buffer after some command (i.e. replace).

To configure it add following to your ~/.config/nvim/init.vim:

set inccommand=nosplit
Enter fullscreen mode Exit fullscreen mode

Or if you're using ~/.vimrc to configure both vim and neovim:

if has("nvim") 
  set inccommand=nosplit
endif
Enter fullscreen mode Exit fullscreen mode

Now, as you type %s/text/replace/before you hit Enter you'll see the live result of your command so you can cancel it by hitting Esc.

You can also set inccommand to split. In that case the result will be shown in a separate split pane.

Top comments (2)

Collapse
 
voyeg3r profile image
Sérgio Araújo

Could you tell us which colorscheme have you used on that screen capture on top?

Collapse
 
konstantin profile image
Konstantin

Image of Bright Data

Maintain Seamless Data Collection – No more rotating IPs or server bans.

Avoid detection with our dynamic IP solutions. Perfect for continuous data scraping without interruptions.

Avoid Detection

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay