How to start vim in insert mode?

Whenever I enter vim, there is a 99% chance that I will go into insert mode and edit the file. Can I make vim always run in insert mode?

+46
vim
Jul 13 '12 at 4:23
source share
4 answers

You can run vim as follows:

vim -c 'startinsert' FILENAME

If you want, you can edit the .bashrc file (if you are using bash) and add this line:

alias vim="vim -c 'startinsert'"

+38
Jul 13. 2018-12-12T00:
source share

You can use vim +star , which is even shorter. NB: star short for :help :start .

If you want this default behavior, the best option is to use

 au BufRead,BufNewFile * start 

in ~/.vimrc if you want a normal function. Also take a look at :h 'insertmode' , which describes a special option made for this kind of function. However, this can make it difficult to exit insert mode, which is crucial for growing your vim ninja skills.

+38
Jul 13 2018-12-12T00:
source share

You can, and it is very simple.

The startinsert command enters insert mode. (This is an exact copy on the command line for input in normal mode.) Just run it in your vimrc so that it starts at startup. Unlike some other suggestions, this does not prevent you from returning to normal mode with ESC as usual.

+18
Dec 06 '12 at 19:20
source share

In addition, there is something called "Easy mode", starting with vim -y or evim . This is a more radical departure than just starting in insert mode: it has some key bindings corresponding to other editors, and normal mode commands are executed by pressing Ctrl + O instead of Esc . As a result, in insert mode, this is a rule, not an exception.

+11
Jul 13 '12 at 5:40
source share



All Articles