Vim Tips Wiki
Register
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
This command (<code>PP</code>) prints lines (like <code>:p</code> or <code>:#</code>) with the search pattern highlighted. I use <code>g//p</code> quite often, and I was missing the highlighting of search pattern. To test this command, try something like:
+
This command (<tt>PP</tt>) prints lines (like <tt>:p</tt> or <tt>:#</tt>) with the search pattern highlighted. I use <tt>g//p</tt> quite often, and I was missing the highlighting of search pattern. To test this command, try something like:
 
<pre>
 
<pre>
 
:g/a/PP
 
:g/a/PP
 
</pre>
 
</pre>
   
If you supply the optional argument <code>#</code> (<code>PP #</code>) then line numbers are also printed.
+
If you supply the optional argument <tt>#</tt> (<tt>PP #</tt>) then line numbers are also printed.
 
<pre>
 
<pre>
 
" command PP: print lines like :p or :# but with with current search pattern highlighted
 
" command PP: print lines like :p or :# but with with current search pattern highlighted
Line 62: Line 62:
 
</pre>
 
</pre>
   
Changes the behaviour of the internal <code>[I</code> to highlight the text now.
+
Changes the behaviour of the internal <tt>[I</tt> to highlight the text now.
   
 
I noticed that it breaks on ^ and $ (if they're alone), also, but that doesn't really happen that often.
 
I noticed that it breaks on ^ and $ (if they're alone), also, but that doesn't really happen that often.
Line 72: Line 72:
 
</pre>
 
</pre>
   
Yes, <code>[I</code> with highlighting is a great idea. Now the only thing lacking is the jump numbers at the start of each line that are right-aligned.
+
Yes, <tt>[I</tt> with highlighting is a great idea. Now the only thing lacking is the jump numbers at the start of each line that are right-aligned.
   
 
About choking on ^ and $ anchors, it actually poses minor practical problems. Searching for ^ or $ alone is useful to indicate the whole line. In the case for ranges:
 
About choking on ^ and $ anchors, it actually poses minor practical problems. Searching for ^ or $ alone is useful to indicate the whole line. In the case for ranges:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)