Here are a couple of tips to improve the searching engine in VIM.
First of all, searching patterns in VIM is quite simple. In command mode, use the
/command. You can use regular expressions too. For example
/^foosearches for the text "foo" in the beginning of a line. You can use very complex regular expresions, whose explanation if far away from the scope of this blog.
The searching commands in VIM takes the focus of the cursor to the next match going downward within the text. If you want to go to the next match, use the command
nSimilarly,
Ntakes you to the former match. The command
?makes the same than "/" but in the opposite direction, this is from the end of the file to the beginning.
Besides these commands, you can configure some of the behaviour of VIM when searchig patterns by adding some lines to the .vimrc file. For example
set incsearchsearch in the text meanwhile you are typing, without waiting you to press enter. Another interesting feature is
set hlsearchwhich highlight the found text. This is very usefull when debuggingg scripts, since you have a very convenient way to taking a look at the patters you want in a given moment.
0 Comments:
Post a Comment