11

Does anyone know how to change vim's default mode? Its default mode is command mode, but could I change it to insert mode?

7
  • 1
    may be this could help vim.wikia.com/wiki/… Commented Nov 7, 2011 at 8:23
  • 10
    Better yet: Just Don't Do It. The main reason for using Vim is to stay away from insert mode as much as possible. Commented Nov 7, 2011 at 8:26
  • 3
    When you start learning Vim, try to forget what you think you know about editing. Learn the Vim way, part of which is spending as little time as possible in insert mode. Give it a week or two and you'll be hooked for life. Commented Nov 7, 2011 at 8:29
  • 1
    It's a bit weird. Do you mean you always want to insert something at the beginning of a file ?Otherwise that means the first thilg you avhe to do is press <esc> Commented Nov 8, 2011 at 11:59
  • 1
    I love Vim and have used it for years - couldn't go back to anything else. But the main reason for using Vim is not to "stay away from insert mode as much as possible." Vim is an editor, it's not going to pluck ideas for content out of thin air - it still relies on your input. For things like Git commit messages, I can definitely see where defaulting to insert mode could be useful. Commented Sep 16, 2019 at 16:22

5 Answers 5

24

Just add the following line to your vimrc:

start 

Vim's default mode will be changed to Insert mode. Just press Esc to enter Command mode.

Sign up to request clarification or add additional context in comments.

Comments

8

You can try the 'insertmode' option (add set insertmode to your .vimrc file), although I recommend that you learn the standard vi operation, because not all vi-like editors support this mode of work.

cheers, mitch

3 Comments

I just added "set insertmode" in my .vimrc and the default mode becomes insert mode! But now even if I typed "/" or ESC, I can not get back to normal mode now.
read :help 'insertmode', 'insertmode' is kinda quirky (that's another reason you should learn the standard operation of vi :). quick hint: CTRL-L goes to command mode when 'insertmode' is on.
The comment by @Maistora above includes a link to the Vim Wiki which addresses this problem.
2

If you really want an editor that starts out in insert mode, perhaps vim is not the editor for you.

Most editors that aren't based on vi behave the way you want. Emacs is very powerful, but it may be too complicated for your needs. Nano (man nano for info nano for more information) might be a good choice. There are other possibilities.

vim really isn't designed to be used that way. As others have said, there are ways to force it to start up in insert mode. (I've been using vi-style editors for decades, and I didn't even know about :set insertmode until now.) But it's awkward to use.

My advice: either (1) use an editor that behaves the way you want, or (2) spend some time learning to use vim in its default configuration, and see if you can get used to it.

One big advantage of vim's separation of insert and command modes is that the command mode can use letters as commands; modeless editors generally have to use control keys or function keys to execute commands.


Update (a decade later): vim has an option -y that starts it with insertmode enabled. evim is equivalent to vim -y, and eview to view -y. From the man page (emphasis added):

eVim starts Vim and sets options to make it behave like a modeless editor. This is still Vim but used as a point-and-click editor. This feels a lot like using Notepad on MS-Windows. eVim will always run in the GUI, to enable the use of menus and toolbar.

Only to be used for people who really can't work with Vim in the normal way. Editing will be much less efficient.

The 'insertmode' option is set to be able to type text directly.
Mappings are setup to make Copy and Paste work with the MS-Windows keys. CTRL-X cuts text, CTRL-C copies text and CTRL-V pastes text. Use CTRL-Q to obtain the original meaning of CTRL-V.

2 Comments

OP isn't asking to obliterate the separation between modes. The question here is: how to change which mode is set to default. Would that change somehow "break" Vim? Is that why you say "vim really isn't designed to be used that way" or is it just that Vim's typical role is as a code editor and not a text composer?
@DylanKinnett See my update.
1

You can use

vi -cstartinsert 

or

vi -cstart 

That launch vi and put it insert mode. You can do an alias to that if it's really usefull (I still understand why you want that anyway). You can also look at this tip.

Comments

1

"Cream" is a project that aims to make Vim easier to use. By default everything you do in Cream is in insert mode, I believe:

http://en.wikipedia.org/wiki/Cream_%28software%29

2 Comments

Seems a lot more complicated than just installing nano.
I agree with @cbmanica here, and a few lines in the vimrc file are even simpler

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.