How do you convert all text in Vim to lowercase? Is it even possible?
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- How to copy the value of a vim option to a registe
- E185: Cannot find color scheme*
- How do I fix vim to properly indent folds containi
use
ggguG
gg : goes to the first line . gu : change to lowercase . G : goes to the last line .
If you really mean small caps, then no, that is not possible – just as it isn’t possible to convert text to bold or italic in any text editor (as opposed to word processor). If you want to convert text to lowercase, create a visual block and press
u
(orU
to convert to uppercase). Tilde (~
) in command mode reverses case of the character under the cursor.If you want to see all text in Vim in small caps, you might want to look at the
guifont
option, or type:set guifont=*
if your Vim flavour supports GUI font chooser.Usually Vu (or VU for uppercase) is enough to turn the whole line into lowercase as V already selects the whole line to apply the action against.
Tilda (~) changes the case of the individual letter, resulting in camel case or the similar.
It is really great how Vim has many many different modes to deal with various occasions and how those modes are neatly organized.
For instance, v - the true visual mode, and the related V - visual line, and Ctrl+Q - visual block modes (what allows you to select blocks, a great feature some other advanced editors also offer usually by holding the Alt key and selecting the text).
Similar to mangledorf's solution, but shorter and layman friendly
:%s/.*/\L&/g
I had a similar issue, and I wanted to use
":%s/old/new/g"
, but ended up using two commands:If you are running under a flavor of Unix