Vim smart insert semicolon

前端 未结 7 899
遇见更好的自我
遇见更好的自我 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条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 01:28

    I want to do the same thing, I works on it whole night, tons of code, but at last, I got a simple solution.

    inoremap ; ;
    

    and if I am in a brace, I want to add a semicolon or a dot at the end, like this

    foo({
      |
    })
    

    I press ;; or .. to do this

    inoremap ; ;
    inoremap . .
    inoremap ;; ;
    inoremap .. .
    

提交回复
热议问题