As always I use my blog as reminder of some useful commands or tips.
This one is for dimi, to change the case of a full document in vi, use the following command to transform everything in lowercase :
<ESC>:%s/.*/\L&/
and in uppercase :
<ESC>:%s/.*/\U&/
I hope this helps 😉
for uppercase: gggUG
for lowercase: ggguG
PS: the first 2 g’s are for moving to the beginning of the document.
PS2: works in vim, don’t know about plain vi
so just wanted to break down that last post so people know what’s up with it.
the first 2 ‘g’s put your cursor to the beginning of the file. the 3rd g puts you in what appears to be a “replace” mode of some kind. U means uppercase (or u means lowercase) the final G means until the end of the file.
So if you want to manipulate just a single word you should move the cursor to the beginning of the word then type gUw ((g)replace to (U)uppercase until (w)the end of the word).
Or if you want to go from the current position to the end of the line gU$ ((g)replace to (U)uppercase until ($)the end of the line).
Or if you want to go from the current position to the next ‘x’ on the line gUtx ((g) replace to (U) uppercase (t) to (x) the x character)… Of course you can replace x with any character you want.
Figured that might help those who don’t know about jumping around in a file.
(also if you only want to do the current line and the next two lines: gU2).
This stuff is handy!
was supposed to be gU2<down arrow>
You can think of the third “g” as “global”… as in “apply this to the whole file”.
I didn’t know what the 3rd g meant. Now I know. Thanks!
To my understanding, “apply to the Whole file” is done by the last ‘G’ not the 3rd ‘g’.
the ‘G’ means “till the end of the document”.
The 3rd ‘g’ would mean “apply to all characters” and may be replace by a regexp, no?
I need a driver for my phillips snn6500 wireless netcard
or smc2632 wireless net card.
I can`t make them run on linpus linux lite.
Please help.
Regards,
VadeDromaro
Simple tip, but it juste saved my day 😀
Thanks alot!
It is neat stuff
Thanks this helps 🙂
Very useful . Thanks a lot 🙂
Good tips, an easier technique so far. A quick help that covers all of the important commands. – Jeffrey Nimer
I had a similar problem: had a list of words, one in each line, and wanted to append a ‘;’ followed by the word in lowercase. Thanks for this page, it helped me find the solution:
:%s/\(.*\)/\1;\L&/g