Live data from Hacker News

Interactive Vim tutorial

openvim.com

121–130 of 230 posts

Re: Interactive Vim tutorial

#121
post #54

Earlier quoted context omitted.

One of the very best features of Emacs is it's built in help system, faster, more convenient and more accurate than most program wikis or on-line documentation. Emacs is too big to learn every one of the 7000 or so functions, one learns just what's useful in a particular realm. Anytime it's necessary to wander into new territory, there is really good built-in help system available. Help commands start with Ctrl-h. Th…

The only gripe I have with emacs help, is that it does require some basic skill to use it. The help opens in a window in the existing frame and you need to know how to jump back and forth and close. It's a bit like having to drive yourself to your learning to drive lessons. But once you've done the built in tutorial a few times, you should have that basic skill.

> The only gripe I have with emacs help, is that it does require some basic skill to use it.

The only thing to know is to press 'q' to quit the help window and get back to where you were.

Re: Interactive Vim tutorial

#122
post #87

Earlier quoted context omitted.

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…

I think we just don't agree about what the good parts of vim are. I find f and t to be a minute improvement over forward search. I think hjkl is strictly better than arrow keys, because you don't have to move your fingers from the home row to navigate a file, and I think the basic editing commands I outlined are sufficient for a superior editing experience within a day of learning them, no deep study required.

Forward search is probably my most used vim feature. /LOCATIONc/NEXT_LOCATION and you can be in insert mode changing the content. The only thing you need to think about is the content you want to change. You don't think about how to get there, you don't think about how many times you need to hit arrow while holding down shift-alt, or the fact that it will always jump one too far and you'll need to shift-leftarrow back one.

Re: Interactive Vim tutorial

#123

A little off-topic, but if you like working in Vim, try using cVim[1] for Chrome. It really makes your browsing experience a lot faster, especially if you're on a laptop. [1] https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojh...

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 would imagine.

- Press 't' to open a new tab.

- Now I realize I want to go back to the previous tab. Press 'Escape' to return to normal mode. Press 'J' to go back to the previous tab.

If this is something that works fine in cVim, I am going to ditch Vimium in favor of cVim today!

Re: Interactive Vim tutorial

#124
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 fully agree with you, however some people are worried by the loss of their daily productivity especially if they are used to using their mouse a lot, for those I will recommend to start learning vim in their browser to surf mouse-free using plugins like SurfingKeys[1], vimium[2](chrome), Vimperator[3](Firefox). Once used to surf without reaching to the mouse and know the essential vim key, you'll be ready to use vi…

[deleted]

Re: Interactive Vim tutorial

#125
best way to learn vim:

(optional) first, go thru vimtutor (just type vimtutor in your shell and press enter).

second, get a vim cheat sheet (google).

finally (most important), code a few things using vim. keep google at the ready to look up "how do (etc)?" to speed up things you're actually doing.

once comfortable with that, maybe watch a few vim tips videos.

after all that, you will probably find vim much more comfortable than gedit, textedit, notepad, etc, just for the power. if you favor ides, you'll probably need to do a lot of tweaking to love raw vim, though or course some ides offer vim keymapping anyway.

Re: Interactive Vim tutorial

#126
post #51

Earlier quoted context omitted.

nnoremap h j Is this possible yet in their elisp config?

You should be able to put (define-key evil-normal-state-map "h" 'evil-next-line) into your dotspacemacs/user-config.

That doesn't work everywhere. This was my dealbreaker with Spacemacs. To remap hjkl to jkl; (imperfectly at that) I had to do the following:

  (define-key evil-normal-state-map (kbd "j") 'evil-backward-char)
  (define-key evil-normal-state-map (kbd "k") 'evil-next-visual-line)
  (define-key evil-normal-state-map (kbd "l") 'evil-previous-visual-line)
  (define-key evil-normal-state-map (kbd ";") 'evil-forward-char)
  
  (define-key evil-visual-state-map (kbd "j") 'evil-backward-char)
  (define-key evil-visual-state-map (kbd "k") 'evil-next-line)
  (define-key evil-visual-state-map (kbd "l") 'evil-previous-line)
  (define-key evil-visual-state-map (kbd ";") 'evil-forward-char)
  
  (define-key evil-motion-state-map (kbd "j") 'evil-backward-char)
  (define-key evil-motion-state-map (kbd "k") 'evil-next-line)
  (define-key evil-motion-state-map (kbd "l") 'evil-previous-line)
  (define-key evil-motion-state-map (kbd ";") 'evil-forward-char)
  
  (define-key dired-mode-map (kbd "j") 'evil-backward-char)
  (define-key dired-mode-map (kbd "k") 'evil-next-line)
  (define-key dired-mode-map (kbd "l") 'evil-previous-line)
  (define-key dired-mode-map (kbd ";") 'evil-forward-char))

Re: Interactive Vim tutorial

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

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.

This configuration is commonly known as "lol jk".

Re: Interactive Vim tutorial

#128
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 use the 'jk' and 'kj' mapping for escape as well, though I've never actually needed to type those characters out myself or at least it's so rare I don't remember. However, everyone is different.

What I'd suggest if you want to give it a try is to also set the `timeoutlen` to a lower value. By default it's usually 1000ms, but that can be dropped quite a bit I believe without much interference.

    autocmd InsertEnter * set timeoutlen=100
    autocmd InsertLeave * set timeoutlen=1000

Re: Interactive Vim tutorial

#129
post #57

Obligatory link to VimGolf, a great way to learn by doing. https://vimgolf.com/

This website sucks, it takes forever to load challenge pages because they're flooded with irrelevant entries which you can't even see if you don't submit your own. You can't even visualize the solutions directly in the browser.

And you never really get to learn anything. I generally come away feeling like there's this knowledge locked in solutions I'll never get to see so there's no way to improve. Seems like a good idea but in practice it's just frustrating.

Re: Interactive Vim tutorial

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

Another approach is using 'jj'.

> The artificial delay I have to introduce between typing "j" and "k" to actually type "jk" is unacceptable.

I tried the CAPS approach and tried using it via my left pinky, but find it too awkward to use - but this is probably a very individual thing and it's good that Vim supports it via its remapping capabilities.

But I hear you, sometimes if I have to type the string "jj" I get really confused, but this happens not very often.

Post reply on HN