Live data from Hacker News

Interactive Vim tutorial

openvim.com

131–140 of 230 posts

Re: Interactive Vim tutorial

#131

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…

If you are relying on accidentally f'ing things up then u and ctrl-r are essential too.

u is my favourite!

Re: Interactive Vim tutorial

#132
post #106

The first thing I do on a new system is map my Caps Lock key to Escape[1][2][3] so that I can use Vim conveniently without having to reach the physical Escape key placed awkwardly at the corner of the keyboard. The choice of Escape key to return to normal mode and H, J, K, L for navigation makes total sense if we look at the original Lear Siegler ADM-3A terminal[4] that Bill Joy used while creating vi, but in the mod…

I had a really hard time getting into Vim until I found out everyone I knew who was using it had mapped something else to escape. Once I did the same, it was much easier to get started.

For me it was the same. Using ESC is really ergonomically awkward for me. There are also people using Ctrl-C (which works by default) - but I prefer the 'jj' or similar method.

It's also useful to use Bash in vim-mode and also remap the esc-key, e.g.

  set editing-mode vi
  set keymap vi

  $if mode=vi
    set keymap vi-insert
    "jj": vi-movement-mode
  $endif
Something like this - you can then search Bash history via '/', etc.

Re: Interactive Vim tutorial

#133
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…

I'm glad GVim works well for you in windows.

Personally I like the simplicity of characters-in-characters-out that comes with working with vim in a terminal. I also like to be able to exit to bash and do redirection trickery on my recently saved files. For these reasons, I avoid GVim.

MSYS2 (which uses MinTTY for its terminal) is what I use, and as far as I've noticed it supports all the bells and whistles that the windows terminal lacks.

Re: Interactive Vim tutorial

#134
post #123

Earlier quoted context omitted.

Is there anything better about this than vimium? The most disappointing thing about using an extension for this is when I open dev tools or a tab fails to load. I love luakit because the browser itself lets you set up vim like commands. Unfortunately I had to give up trying to build it for macOS

Vimium has been a very frustrating experience for me. The one thing where I always trip: - Press 't' to open a new tab. - Now I realize I want to go back to the previous tab. I press 'Escape'. Nothing happens. The focus is stuck in the address bar. I press 'J' and of course the 'J' gets typed into the address bar. How do I escape back to normal mode? I can't figure. With VimFx for Firefox, it works exactly as one wou…

I tried pentadectyl for firefox and couldn't get it to work after 1 hour of messing around (some version issues). I'll try vimfx because I'm not too happy with cvim either mainly because it won't run on chrome:// pages which makes it necessary to use the mouse afterall.

Re: Interactive Vim tutorial

#135
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…

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.

Re: Interactive Vim tutorial

#136
post #77

Honestly though, is it even worth learning? I've tried learning VIM a few times and always gave up, and feel like my editors shortcuts cover most cases anyway. There's also not that many times where I feel like coding speed is required. Honestly curious how much more productive you guys feel after learning VIM.

Although learning Vim gives you a productive editing environment, another advantage can be health related.

I find it more comfortable to have my fingers on the home row, than stretching them to pull off CTRL key-sequences.

Re: Interactive Vim tutorial

#137

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 came to the comments after a bit of the tutorial to write something along the same lines but less eloquently. I absolutely agree, too much too fast.

My hackles were raised when it starts with "ESC" to enter normal mode and "i" for insert mode. Rather than "i" for insert mode and "ESC" to get out of insert mode. Also, I used the arrow keys to move around in vim for ages before I disabled them.

Re: Interactive Vim tutorial

#138
Author here.

The tutorial succeeds if it gets people to have a superficial comprehension what Vim is about -- especially for those that have been putting off trying it out in a terminal. That's it. It doesn't really try to make you actually learn Vim.

As a tutorial it could be made so much better. I don't have the energy slots for this project. But I feel anxious when I get feedback because I feel like there's some moral duty to fix the site. The least I can do is to pay for the hosting so that people get to have a go with it as it seems some people like it.

Just to make clear: the Vim behaviour is modelled and is not just trivial precoding of keystream. There is a sandbox where you have contextual helper at the right side of the screen. You can play around with it to your heart's and battery's content. But it is merely a simplistic version of Vim.

Development-wise the most fun aspect of the tutorial was the DSL for tests. For some reason (haven't really updated the code properly in years) many fails. But click on the individual tests and you see something fun. http://openvim.com/tests.html See the corresponding code here: https://github.com/egaga/openvim/blob/87b9e1d62c4144c958ddf8...

The actual code is modelled operating on html elements. This was a fun side project, so please don't be too critical. It grew bigger than anticipated.

Re: Interactive Vim tutorial

#139

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…

>learning to use x and d early on is probably also a good idea, if like me you're the kind of person who makes mistakes

Same with using 's'. Super handy when you accidentally type the wrong character.

Re: Interactive Vim tutorial

#140
Thanks for making this tutorial and helping more people with Vim! I actually started learning Vim a few months ago. And to help me practice, a friend of mine recommended Vimgolf challenges. Since then I’ve been making weekly videos about the solutions to those challenges. I started it because some of the solutions were really hard to understand and I had almost given up a few times. I hope that by making videos it’ll help people see and understand some of the more complicated vim commands. I thought this would be a good place to share, hope it helps someone!

https://www.youtube.com/channel/UC9xP5LRmm2qbSKq6nHTB_bw?vie...

Post reply on HN