Vim smart insert semicolon

前端 未结 7 900
遇见更好的自我
遇见更好的自我 2021-02-04 00:49

Is there a Vim plugin that can handle smart semicolon insertion, like the one in Eclipse?

Example (pipe character is insertion cursor):

foobar(|)
         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 01:19

    inoremap  ; getline('.')[-1:] == ';' ? '\' : ';'
    

    The code above will check if there is ; at the end of the line.

    If ; not exists, then it will add ; otherwise do nothing.

提交回复
热议问题