LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-29-2017, 09:59 AM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,065

Rep: Reputation: 165Reputation: 165
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
 
Old 08-29-2017, 10:36 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138
I always just hit search, then mash the keyboard a bit to enter nonsense.
 
Old 08-29-2017, 11:04 AM   #3
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,065

Original Poster
Rep: Reputation: 165Reputation: 165
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
 
Old 08-29-2017, 11:32 AM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,988

Rep: Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570
I use a plugin to deal with this:

https://github.com/junegunn/vim-slash
 
Old 08-29-2017, 03:26 PM   #5
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,065

Original Poster
Rep: Reputation: 165Reputation: 165
Thanks dugan.

Looks interesting.

Ken
 
Old 08-29-2017, 04:51 PM   #6
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Hmm, can't you just use :noh to get rid of that?
 
1 members found this post helpful.
Old 08-29-2017, 05:59 PM   #7
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,065

Original Poster
Rep: Reputation: 165Reputation: 165
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 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?
 
Old 08-29-2017, 09:00 PM   #8
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 633

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Quote:
Originally Posted by taylorkh View Post
...
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.
 
Old 08-30-2017, 07:11 AM   #9
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,065

Original Poster
Rep: Reputation: 165Reputation: 165
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

Ken
 
Old 08-31-2017, 08:03 PM   #10
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,988

Rep: Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570Reputation: 4570
Quote:
Originally Posted by taylorkh View Post
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Tried everything, searched and searched: Php7 (LAMP install) signmeuptoo Linux - Newbie 64 08-01-2017 12:35 PM
[SOLVED] Vim Slackbuild fails to fetch vim 8.000x sources from github on -current mats_b_tegner Slackware 4 09-15-2016 06:56 PM
[SOLVED] Fedora shows 'man vim' but when execute 'vim' got "bash: vim: command not found..." ? flash_os Linux - Newbie 19 01-03-2015 11:56 PM
Switching from vim to vim -g from inside vim iDragoon Linux - Software 4 05-15-2009 11:46 AM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration