docs:vim:search_and_replace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:vim:search_and_replace [2009/01/22 11:21] billhdocs:vim:search_and_replace [2009/01/22 11:27] (current) billh
Line 6: Line 6:
     * g - tells vim to replace all instances on each line, instead of just the first     * g - tells vim to replace all instances on each line, instead of just the first
  
-===== Metacharacters =====+==== Metacharacters ====
 |.  |any character except new line  | |.  |any character except new line  |
 |\s  |whitespace character | |\s  |whitespace character |
Line 44: Line 44:
 Search results can be replaced with special characters like this: Search results can be replaced with special characters like this:
   * type :%s/SEARCH/   * type :%s/SEARCH/
-  * press CTRL-V (CTRL-Q on windows) +  * press CTRL-V (CTRL-Q on windows); you now have the option to: 
-  now type the 3 digit decimal value for the character you want+    * type the 3 digit decimal value for the character you want 
 +    * type x then the 2 character hex value you want 
 +    * type o then the 3 digit octal value you want
   * full example to replace all occurances of SEARCH with a vertical tab:<code>   * full example to replace all occurances of SEARCH with a vertical tab:<code>
 :%s/SEARCH/ :%s/SEARCH/
 (press CTRL-V or CTRL-Q) (press CTRL-V or CTRL-Q)
-011/g+(press the letter o) 
 +013/g
 </code> </code>
 +  * once the replace is done, you can move the cursor over the character and type 'ga' to see the decimal, hex, and octal values
  • docs/vim/search_and_replace.1232648504.txt.gz
  • Last modified: 2009/01/22 11:21
  • by billh