如何将Vim中的所有文本转换为小写?这可能吗?


当前回答

我假设你想要小写的文本。解决方法很简单:

ggVGu

解释:

Gg -指向文本的第一行 V -打开视觉选择,在直线模式下 G -转到文件的结尾(此时你已经选择了整个文本) 小写的选定区域

其他回答

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 (or U 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.

我假设你想要小写的文本。解决方法很简单:

ggVGu

解释:

Gg -指向文本的第一行 V -打开视觉选择,在直线模式下 G -转到文件的结尾(此时你已经选择了整个文本) 小写的选定区域

使用ggguG

Gg:到第一行。

Gu:小写。

G:排到最后一行。

使用此命令模式选项

ggguG


gg - Goto the first line 
g  - start to converting from current line    
u  - Convert into lower case for all characters
G  - To end of the file.

我有一个类似的问题,我想使用“:%s/old/new/g”,但最终使用了两个命令:

:0
gu:$