I am writing a shell script to view a text file and search for a pattern. I want to specify this pattern in the command line when launching Vim.
This command is what I am currently using do accomplish this:
vim mylogfile.txt +"/findthisvalue"
The above command works great when the text file contains this pattern. However, if the pattern is not in the file, I want Vim to fail gracefully.
Right now, when it fails to find the pattern in the text file, Vim pops up an error saying the following:
"Error detected while processing command line:
E486: Pattern not found: 01:50:37x
Press ENTER or type command to continue"
Is there a way to tell Vim to just print in the status bar "E486: Pattern not found: findthisvalue"
and not display the "Press ENTER to type command to continue"?
What would be the proper command-line to do that?