【发布时间】:2011-02-26 03:01:08
【问题描述】:
Vim 中是否有改变所选文本大小写的命令?
【问题讨论】:
标签: vim
Vim 中是否有改变所选文本大小写的命令?
【问题讨论】:
标签: vim
查看以下方法:
~ : 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
g~w : Invert case to current WORD
guG : Change to lowercase until the end of document.
gU) : Change until end of sentence to upper case
gu} : Change to end of paragraph to lower case
gU5j : Change 5 lines below to upper case
gu3k : Change 3 lines above to lower case
【讨论】:
guw 将大小写从当前位置更改到单词末尾。 guaw 或 guiw 改变整个单词的大小写。
Visual select the text,然后 U 表示大写或 u 表示小写。要交换视觉选择中的所有大小写,请按 ~(波浪号)。
如果不使用视觉选择,gU<motion> 会将 motion 中的字符变为大写,或者使用 gu<motion> 变为小写。
有关更多信息,请参阅Vim's change.txt 帮助文件中的第 3 节。
【讨论】:
g~<motion> 也有效。可能要补充一点,我倾向于专门使用~。
gUiw将一个单词变成大写。谢谢!