LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Tell vim to FORGET WHAT I LAST SEARCHED FOR! (https://www.linuxquestions.org/questions/linux-newbie-8/tell-vim-to-forget-what-i-last-searched-for-4175612843/)

taylorkh 08-29-2017 09:59 AM

Tell vim to FORGET WHAT I LAST SEARCHED FOR!
 
On one of my CentOS 7 servers I accidentally executed a search (? in command mode) in vim while editing /etc/fstab. The couple of characters I accidentally searched for were highlighted as expected. Unexpectedly and annoyingly those two characters are highlighted in every file I open in vim on that machine - provided the characters are present in the file of course.

I have found a lot of references to the search capabilities of vim but nothing about finishing the search and getting on with business. So the question is...

How do I tell vim NOT to search any more?

TIA,

Ken

suicidaleggroll 08-29-2017 10:36 AM

I always just hit search, then mash the keyboard a bit to enter nonsense.

taylorkh 08-29-2017 11:04 AM

Thanks suicidaleggroll.

That would certainly do the trick. I was looking for something "built in" which I had overlooked. For my next trick I decided to figure out where vim saved its "history." Seems it is in ~/.viminfo. Wow! What a bunch of crap it stores. Almost as bad as browser history. I cleared the item titled "# Last Search Pattern:" and that seemed to do the trick. There is also a section with search history going back how far I do not know as I do not use search in vim except by accident or in the test. Unbelievable.

Ken

dugan 08-29-2017 11:32 AM

I use a plugin to deal with this:

https://github.com/junegunn/vim-slash

taylorkh 08-29-2017 03:26 PM

Thanks dugan.

Looks interesting.

Ken

dejank 08-29-2017 04:51 PM

Hmm, can't you just use :noh to get rid of that?

taylorkh 08-29-2017 05:59 PM

Thank you dejank! That does the trick exactly. It seems from my further searching that :noh is short for :nohlsearch which make sense.

I am taking a Red Hat admin course at the local community college - just something to do, I am RETIRED :D The course is delving into vim deeper than I typically use it but only scratching the surface from what I am finding with my research. It is a tremendously full featured and complicated program. yum tells me the installed size of the package is 2.2 MB. By comparison, Wordstar on my Osborne CP/M computer fit on a 180 KB diskette with room for CP/M and some data files. Wordstar was a fully functional word processor AND a great program editor. I wonder if we are really moving forward?

Ken

p.s. I wonder if I can find a CP/M emulator? And my old Wordstar software?

Sefyir 08-29-2017 09:00 PM

Quote:

Originally Posted by taylorkh (Post 5753485)
...
It is a tremendously full featured and complicated program. yum tells me the installed size of the package is 2.2 MB. By comparison, Wordstar on my Osborne CP/M computer fit on a 180 KB diskette with room for CP/M and some data files. Wordstar was a fully functional word processor AND a great program editor. I wonder if we are really moving forward?
...

I wouldn't worry too much about that :)

Code:

sudo apt-get remove atom
The following packages will be REMOVED:
  atom
0 upgraded, 0 newly installed, 1 to remove and 27 not upgraded.
After this operation, 243 MB disk space will be freed.

If you find vim useful, combining it with YouCompleteMe will reach a whole new level, allowing for a lot of autocompletion.

taylorkh 08-30-2017 07:11 AM

Thanks Sefyir,

Fortunately I do not have atom installed on my CentOS 7 machines nor on a couple of Ubuntu Mate 16.14 virtual machines. I do not know what it is and probably don't want to know :D

Ken

dugan 08-31-2017 08:03 PM

Quote:

Originally Posted by taylorkh (Post 5753485)
By comparison, Wordstar on my Osborne CP/M computer fit on a 180 KB diskette with room for CP/M and some data files. Wordstar was a fully functional word processor AND a great program editor. I wonder if we are really moving forward?

I think you might enjoy this:

http://www2.b3ta.com/heyhey16k/


All times are GMT -5. The time now is 04:20 AM.