Jump to content
Sign in to follow this  
fuzzylizard

How to clear a pattern match in vim?

Recommended Posts

I think this is programming related, anyway...

 

I was using vim last night to edit some programs and accidently typed in '/y'. Now the program is highlighting every y on the page. And to make things worse, this pattern matching persists beyond closing the program.

 

I am a vim newbie, how do I turn this off?

Share this post


Link to post
Share on other sites

Yep, I can pattern match anything and the annoying highlights just shift to the new pattern. And yea, it persists.

 

Very annoying. I will check out the link above for the answer.

 

 

No vim gurus out there?!?

Share this post


Link to post
Share on other sites
I think this is programming related, anyway...

 

I was using vim last night to edit some programs and accidently typed in '/y'. Now the program is highlighting every y on the page. And to make things worse, this pattern matching persists beyond closing the program.

 

I am a vim newbie, how do I turn this off?

 

Within the session, after a search you can remove the highlight by typing in command mode ":noh" , or faster, enter a new search which doesn't exist (ie: /adfasdfasd)

 

If you dislike the search highlighting and you want to remove that feature, then edit your ~/.vimrc file and append this: "set nohlsearch"

Share this post


Link to post
Share on other sites
Guest lahtris

put this in your .vimrc

 

nmap <SPACE> <SPACE>:noh<CR>

 

after you perform a search, pressing space in normal mode will still do what space did (usually advance one character), but also clear the highlighting. This way, you can leave the highlighting on if you want (by not hitting space).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...