3

I tried VIM and liked it but something stopped from using it: I had to type ESC to often, very often, something like each 5 seconds, and it was highly uncomfortable, so I stopped using it as a primary text editor (now I use emacs, nice for programmer as I am).

After my sad experience with VIM, I could get why some much intensive users love vim. But now I suppose that maybe, after a bigger training, the frequency of mode switching could decrease dramatically.

So, to verify this hypothesis, I am asking to you, old vim users, how frequently do you switch the mode?

BenjaminB
  • 1,706

9 Answers9

9

I've been using vi/vim for nearly 30 years now, and I must say I've never found the mode switching an issue. And you don't think emacs has modes????

As to your question, I really couldn't say. I suppose my work pattern is:

  • open a file
  • move around in command mode until I find the right place
  • go into insert mode and write some text
  • go into command mode and savethe file
  • compile
  • in command mode (note probably NOT in insert mode) fix syntax errors
  • repeat as needed

So I tend to do reasonable sized blocks of work in each mode. It's not like I'm typing a character, switching to command, issuing a command, going to insert, typing another character.

9

I can't tell you how often I switch modes, because it's almost second nature. It's not something I do consciously and I think most people agree on this. I did remap Caps Lock to Esc and it is much better, highly recommended.

Maybe the first week was like that as you paint it. I forced myself to use it for everything and it stopped being frustrating after a week. If you want to master it, I suggest the same. There are some good blog posts out there about setting up a comfortable environment (mainly about the tons of options configurable in .vimrc).

2

I switch modes... always. Esc is the most popular key on my keyboard. Even in browser, typing this very message, I've hit Esc a couple of times, because it's already a habit. And I don't care! Smoking, for instance, would be a much worse habit.

However, if it really bothers you that much, I suggest you to see a shrink.

P Shved
  • 7,477
  • 36
  • 51
2

Most vim users would be switching between insert and visual mode all the time. Esc does suck to type a often. The day I started using Ctrl-c in place of Esc was the day my productivity increased tenfold. I think reaching for the Esc key a lot would mildly strain my left hand too...

J.K.
  • 13,113
1

You can remap ESC to whatever key combination you want :

I have the following code in my .vimrc :

" remap ESC to ii to avoid leaving home row to leave insert mode
" i to enter insert mode, ii to leave
inoremap ii <Esc>
vnoremap ii <Esc>
snoremap ii <Esc>

When you are in Insert, Visual or Select mode you can use 'ii' instead of ESC.

As long as you are not editing a file with variables containing 'ii' it works fine.

If I remember correctly, when Vi was developed the ESC key was at the same place that the CAPS lock on current keyboards. It was much easier to reach. As a consequence some people are using CAPS lock to switch mode.

Xavier T.
  • 1,622
1

It depends on what I am doing.

When I'm banging out new code I am in Insert mode most of the time.

When I'm editing code on the PC I make use of the arrow keys quite a lot so I can stay in insert mode quite a lot. Its a bad habit, but one that's hard to break.

When coding on my iPhone over SSH, I don't have the arrow keys so have to come out of Insert mode pretty often to navigate.

You get used to it. Even when coding in Visual Studio I find myself pressing escape every 10 seconds.

Mongus Pong
  • 1,418
1

The trick for me is to stay in command mode by default. Switch to insert/replace mode, enter text, switch straight back. If I leave the screen and come back, I'm in command mode; if I'm moving around the document, I'm in command mode. And so on.

That's not to say that I don't spend a fair amount of time in insert mode. It just means that while I'm there, I'm aware that I'm not in command mode and that I need to hit escape when I stop typing.

Why is this useful to you? What I quickly found is that I stop thinking of it as switching "modes" and started thinking of i/a/o (etc) as commands, which are followed by a string of characters and completed using ESC.

pdr
  • 53,768
0

I'm a new VIM user, and switch modes just about as often. Though, I hasn't remapped my keys, the default secondary Ctrl-[ works well for me.

However, what I find important, isn't that I need to switch modes often. It's simply that I rarely need to switch context. When I'm working, I'm working, and the mechanics doesn't really matter.

tylermac
  • 348
-2

to change the mode ,you can use ctrl-[ to replace the esc

It will work better! stick with it and you will done!