Since discovering VIM, I find it simpler to type SQL in lower case and then to make the words that I need uppercase. Is there a way to skip over a word in visual mode such that it will not be made part of the selection, so that I might select all the MySQL keywords and then perform U on them? For instance, assuming this SQL query:
select a.name, b.userid from someTable a inner join anotherTable b on a.someField=b.someOtherField group by a.randomField sort on b.yetAnotherField desc;
I would like to select the first word (select), skip two words, select another word (from), skip two word, select two words (inner join), and so on.
I do have Ctrl-6 mapped to upper case letters (to avoid having Caps Lock activated in Normal mode), but I really do prefer to type out the SQL in lower case first and then to “fix” it. I also know that the lower case SQL is valid, but coding practices dictate that it should all be upper case in code.
I tried to write a function that would traverse the current line and uppercase all the MySQL keywords. However, even if I do go that route, I would still like to know the solution to skipping words in Visual mode as I see other uses for it as well.
If you are going to move your cursor along the whole line, another route is to not use visual mode at all:
select, typegUiwto turn it intoSELECT.fromwith multiplew(inneficient, maybe) or with/fr<CR>(faster, less typing, maybe)..to repeat the last edit and turnfromintoFROM.