Live data from Hacker News

Interactive Vim tutorial

openvim.com

211–220 of 230 posts

Re: Interactive Vim tutorial

#211

Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…

As a heavy vim user for 15~ years I don't find h,j,k,l useful and for new users that may be one of the most confusing / alien changes.

Re: Interactive Vim tutorial

#212

Earlier quoted context omitted.

It's a fair point. I learned ESC long years before ^[ and it's stuck in my muscle memory. But a new user might benefit from using ^[ instead. Some keyboards put F1 where ESC belongs, and my habit has been to remap F1 to NOP because help is so annoying, but maybe I should remap ESC to help. That would get me to switch over in short order.

I've remapped capslock to ESC. I can't remember ever wanting to use capslock mode since I first learned to touch type. Much easier to have Esc there. Or Backspace, Home, End, or delete are also good options.

Like sibling, I also mapped capslock to control. I use ^[ instead of ESC and there are other control- shortcuts that are extremely useful, so it gets more utility than ESC would.

Of course, then I bought a kinesis advantage2 keyboard and now suddenly every key is easy to press, even the cursor keys.

Re: Interactive Vim tutorial

#213
post #117

Earlier quoted context omitted.

Mapping jk and kj to escape and mapping caps lock to some other hyper key is way better than caps lock to esc IMO. You can just mash both j and k together and you are out of it. inoremap jk And inoremap kj In your vimrc file should do it.

I have considered such alternatives in the past and they did not work for me. For example, how can I conveniently type the string "jk" or "kj" with such a configuration? The artificial delay I have to introduce between typing "j" and "k" to actually type "jk" is unacceptable. Although it is rare, I sometimes do have to type "jk" in special circumstances such as while typing LaTeX code. Mapping Caps Lock to Escape is…

Alternatively, map caps lock to control and use Ctrl-C or Ctrl-[ instead of escape. That way, you can also easily type any other Ctrl+whatever shortcut too, which IMHO is a bigger win than just escape, especially when Ctrl-[ is so super easy to type then.

Re: Interactive Vim tutorial

#214

Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…

Agreed, though arguably you need to tell newbs that in order to quit, they must type :q!, not just :q!

Re: Interactive Vim tutorial

#215
post #42

All these tutorials are like taking beginner French. If you want to learn French live in France. If you want to learn Vim you have to live in it. Use it for your development full time. Then over time you start to see it's power. For me on Windows, GVim was the only sane option. Mostly because the Windows console can't fully handle syntax highlighting / italics. However it's also a good transition world. You've got al…

If you can't go to France start by changing all your locales to French. Computer, phone, TV, everything.

Re: Interactive Vim tutorial

#216
post #158

Earlier quoted context omitted.

You might be right. It's true that vim has a learning curve one way or another. On the other hand, if I want to show someone the "good parts" of vim, I try to show them something they can't do in another editor, rather than something that they can do (arrow keys). Even if I 100% agree that arrow keys are a worse experience, it's just not as convincing as something that can't be done outside of vim. At least in my exp…

Yeah, but that's a good way to sell vim. Once you've shown someone vim and whet their appetite, it's probably best to show them about 2 or 3 features and let them fill in the blanks while being at least minimally productive. I've recently taken this approach to emacs and org-mode. I'm a long-time vim user with a super-optimized vimrc, so I know what productivity feels like. I threw in spacemacs to reduce the learning…

Hmm, I've just decided to start slowly learning vim by adding some vim-like functionality to my browsers.

Re: Interactive Vim tutorial

#217
post #87

Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…

Sorry, but I think that's really bad advice. For one thing, it doesn't give new users any positive experience or reason to learn vim. If all you learn is to do things that are "pointless" (like learning hjkl), then you won't get any value out of vim. And if your way of learning is to do something that screws up your file and try to recreate how that happened, well, let's just say that every time I do something that s…

So I've been thinking about this and your other responses in this thread, and I think I've figured out where our viewpoints differ, fundamentally. I think many people, yourself included, want to do more with an editor. That's your motivation for using vim, and so you pursue customization, advanced features, and relentlessly minimize keystrokes. (That's a plural you, by the way. I'm speaking to everyone advocating a bells-and-whistles approach to learning vim.) I want to emphasize that there's nothing wrong with this -- it's a perfectly valid frame of mind, but it's just not my frame of mind. In contrast, I want to think less about my editor. That is, I want editing text to be as automatic as touch-typing. I want for there to be as little friction between my mind and the screen as possible, so I don't want to learn new things about my editor any faster than I can incorporate them into the set of things I can do without thinking about them. As a result, I'm sure there are people who've been using vim for two weeks who know more features than I do after 20 years.

Anyhow, I'd be really interested to know if you agree with this characterization of your outlook.

Re: Interactive Vim tutorial

#218

Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…

I always recommend 'Your problem with Vim is that you don't grok vi.' to new users starting out in vim [0]. You can never learn about the language of vim too early. [0] https://stackoverflow.com/a/1220118/2131903

Thank you for that link. I appreciate that he chose to intersperse the history of commands (such as grep!) within his explanation.

Re: Interactive Vim tutorial

#219
post #158

Earlier quoted context omitted.

You might be right. It's true that vim has a learning curve one way or another. On the other hand, if I want to show someone the "good parts" of vim, I try to show them something they can't do in another editor, rather than something that they can do (arrow keys). Even if I 100% agree that arrow keys are a worse experience, it's just not as convincing as something that can't be done outside of vim. At least in my exp…

Yeah, but that's a good way to sell vim. Once you've shown someone vim and whet their appetite, it's probably best to show them about 2 or 3 features and let them fill in the blanks while being at least minimally productive. I've recently taken this approach to emacs and org-mode. I'm a long-time vim user with a super-optimized vimrc, so I know what productivity feels like. I threw in spacemacs to reduce the learning…

The best way to impress someone with vim is to do "shift+o" and "o"

Re: Interactive Vim tutorial

#220
post #177

Earlier quoted context omitted.

I have had to type jk or kj very rarely that the egronomics of not having to move my pinky to the caps lock key every time that I need to escape is way worth the extremely minor problem of having to wait a second when I need to type jk. Optimize for the common and handle the exeptional.

The inoremap jk , inoremap kj configuration gets you back to normal mode only from insert mode. What do you do if you want to return to normal mode from visual mode or command mode? What if you want to type an abbreviation and expand it when you escape from insert mode to normal mode?

> What if you want to type an abbreviation and expand it when you escape from insert mode to normal mode?

I press space or tab or enter or actual escape if I need an abbreviation and it happens to be at the end of what I intended to insert... I pretty much never rely on escape to do the abbreviations though because it's not at the end of what I want to insert anyway.

I also don't use visual mode enough to need to have an escape for it. you can certainly change the timeout on visual mode and add a visual mode mapping for that too if you want to do that. It seems you have a the attitude of this is the only "correct" way to do it. I don't really care if you use it or not... I was merely providing an alternative way to do what you want with the added benefit of it giving you an extra modifier key that you can bind other things to. You can also map it globally or for each of the handful of modes you want to escape from using it.

Post reply on HN