Entering insert mode automatically when editing git commit messages

前端 未结 3 2183
难免孤独
难免孤独 2021-02-19 01:37

If I do a git commit, when Vim opens, I want to be in insert mode straight away.

I noticed that the filetype is set to gitcommit w

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 02:20

    An alternate approach:

    export GIT_EDITOR='vim +startinsert'
    

    or add ! in the end to start from the end of message (useful, when using git hooks for message completion)

    export GIT_EDITOR='vim +startinsert!'
    

提交回复
热议问题