Changing case in Vim

前端 未结 2 1100
执念已碎
执念已碎 2021-01-29 17:05

Is there a command in Vim that changes the case of the selected text?

相关标签:
2条回答
  • 2021-01-29 17:50

    Visual select the text, then U for uppercase or u for lowercase. To swap all casing in a visual selection, press ~ (tilde).

    Without using a visual selection, gU<motion> will make the characters in motion uppercase, or use gu<motion> for lowercase.

    For more of these, see Section 3 in Vim's change.txt help file.

    0 讨论(0)
  • 2021-01-29 18:00

    See the following methods:

     ~    : 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.
    
    0 讨论(0)
提交回复
热议问题