1

How do i remove the row lines at the start of the line? I typed the command

:s/^/# /

while in command mode and it suddenly appeared. I typed the command again, but it's still in my editor. I was trying to comment out a few blocks of code. This is the stackoverflow page I was following: What's a quick way to comment/uncomment lines in Vim?

Please see the image below to see what I'm pertaining to. Thanks in advance!

image

Community
  • 1
  • 1
olegdeleon
  • 13
  • 5

1 Answers1

2

Vim highlights the current search pattern; this is the 'incsearch' option; either you have it explicitly turned on in your ~/.vimrc, or you use a recent Vim 8 version that has this enabled by the defaults.

Check with :hi IncSearch; it should show the same white-underscore-onblack formatting as your screenshot. You can also use a :hi command to customize this (or choose a different colorscheme).

To turn this off, use

:nohlsearch

You can shorten that to :noh; some people also define a mapping to quickly clear this. Alternatively, you can also search for something else.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324