5 ms·
vim: select your text, press the ~ key until you get the case you want ..
by boffinAudio 4y ago
vim: select your text, press the ~ key until you get the case you want ..
- throw0101c 4y ago> until you get the case you want The GP was talking about a particular type of formatting: * https://en.wikipedia.org/wiki/Title_case https://en.wikipedia.org/wiki/Title_case
- boffinAudio 4y ago: help case To turn one line into title caps, make every first letter of a word uppercase: :s/\v<(.)(\w*)/\u\1\L\2/g
- vulcan01 4y agoThat's not title case - you don't capitalize words such as a, the, of, etc. unless they are at the beginning of the title.
- tablespoon 4y ago> That's not title case - you don't capitalize words such as a, the, of, etc. unless they are at the beginning of the title. Exactly. Capitalizing every letter is the lazy, half-ass pseudo title case that I always have to correct. Unfortunately its becoming normalized because many major companies that should know better don't even bother to do it right.
- tambourine_man 4y agoYeah, I love vim, but that’s not its forte
- amcpu 4y agoYou could also use the vim :%!python3 your_script.py (where your_script.py does the work to format the text) command that takes the text of the buffer as stdin to the script and replaces the buffer contents with stdout of the script. This can also be combined with visual mode linewise to only replace specific lines of the buffer (must work on entire lines selected).