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


当前回答

用g~切换大小写“HellO”到“HellO”,然后移动。 大写的“HellO”到“HellO”加上gU然后移动。 小写的“HellO”到“HellO”加上gu然后一个动作。

有关例子和更多信息,请阅读以下内容: http://vim.wikia.com/wiki/Switching_case_of_characters

其他回答

如果您在某种Unix系统下运行

:0,$!tr "[A-Z]" "[a-z]"

类似于mangledorf的解决方案,但更简短,对外行更友好

: % s / . * \ l / 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.

用g~切换大小写“HellO”到“HellO”,然后移动。 大写的“HellO”到“HellO”加上gU然后移动。 小写的“HellO”到“HellO”加上gu然后一个动作。

有关例子和更多信息,请阅读以下内容: http://vim.wikia.com/wiki/Switching_case_of_characters