2010-05-31 46 views
122

在Vim中是否有命令可以更改所选文本的大小写?在Vim中更改案例

+0

一个有用的链接我想:http://vim.wikia.com/wiki/Switching_case_of_characters – yuan 2013-11-02 14:18:37

回答

153

可视化选择文本,然后U为大写或u为小写。要在视觉选择中交换所有外壳,请按~

如果不使用视觉选择,gU<motion>将使motion中的字符为大写,或使用gu<motion>为小写。

有关更多信息,请参见Vim's change.txt帮助文件中的第3部分。

102

请参见下面的方法:

~ : Changes the case of current character 

guu : Change current line from upper to lower. 

gUU : Change current LINE from lower to upper. 

guw : Change to end of current WORD from upper to lower. 

guaw : Change all of current WORD to lower. 

gUw : Change to end of current WORD from lower to upper. 

gUaw : Change all of current WORD to upper. 

g~~ : Invert case to entire line