Wednesday, January 9, 2008
The Ultimate VI Helpline is here: http://www.vmunix.com/~gabor/vi.html
We have commands like "tr", tools like "sed", strong one liners from perl to do the conversions of lowercase UPPERCASE Titlecase . "vi" too provides the same, some of its :ex commands are below.
:1,$ s/.*/\L&/ #Make whole file contents lowercase
:1,$ s/.*/\U&/ #Make whole file contents uppercase
:1,$ s/\<./\u&/g #Make first letter of all words uppercase
:1,$ s/\<./\u&/gc #Make first letter of all words uppercase with confirmation, this will go to all words even
though the first letter is UPPERCASE
:1,$ s/\<[a-z]/\u&/gc #Same as above, but this will go to all words with a lowercase first lettter.
© Jadu Saikia www.UNIXCL.com