How to convert all text to lowercase in Vim

前端 未结 10 1588
刺人心
刺人心 2021-01-29 18:21

How do you convert all text in Vim to lowercase? Is it even possible?

10条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 18:48

    Many ways to skin a cat... here's the way I just posted about:

    
    :%s/[A-Z]/\L&/g
    

    Likewise for upper case:

    
    :%s/[a-z]/\U&/g
    

    I prefer this way because I am using this construct (:%s/[pattern]/replace/g) all the time so it's more natural.

提交回复
热议问题