Live data from Hacker News

Interactive Vim tutorial

openvim.com

181–190 of 230 posts

Re: Interactive Vim tutorial

#181
post #117

Earlier quoted context omitted.

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 *…

This 'jk' and 'kj' mapping works only to get out of the Insert mode. But it does not match the full capability of the original 'Escape'.

- How do you escape from visual mode to normal mode?

- How do you ensure that your abbreviation gets expanded when you escape from insert mode to normal mode?

- How do you escape from operator-pending mode to normal mode? With this mapping, if you press 'd' to delete something and then change your mind and decide to return to normal mode, you are forced to use the original 'Escape' anyway. If you happen to press 'jk' due to habit at this time, it is going to end up deleting lines.

For these reasons, I thought to have a clean mapping of another convenient key (such as Caps Lock) to Escape at an operating system level, rather than trying to make Vim treat some other key as Escape in certain modes.

Re: Interactive Vim tutorial

#182

Earlier quoted context omitted.

> especially considering the location of the ESC key This can be solved by remapping ESC to Capslock.

Exactly. Or remap it to any key combination that makes sense for your work, if you like using Capslock for its original purpose, which I happen to. For example, I have jj and jk mapped to ESC. So I just tap j twice while in insert mode, and it switches to normal/command mode. If you find yourself needing to type jj or jk often in insert mode, just pick other letters that make sense for you. To use mine, plop these in…

I do it with zz, which I find is consistent with ZZ (save and quit).

Re: Interactive Vim tutorial

#183
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.

For me the productivity boost is mostly a matter of having a suite of very powerful shortcuts/commands that I can use everywhere. I use them in all IDE's (IntelliJ, Visual Studio, Eclipse all have great vim plugins); I use them in any terminal I get access to, even when I can't install software; and I use them in less, Chrome, man and other other tools that copy vim's shortcuts either natively or through plugins. In…

I really like the sound of this, and it's one of the reasons I've persisted with learning vim. But I have to admit, I have remapped a fair amount of stuff, so I'm not sure if it would apply to me. Do those vim-mode plugins allow you to remap keys or load your vimrc?

Re: Interactive Vim tutorial

#184
post #126

Earlier quoted context omitted.

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-ke…

  (defun multi-evil-define (d symb)
  	(define-key evil-normal-state-map d symb)
  	(define-key evil-motion-state-map d symb)
  	(define-key evil-visual-state-map d symb)
  	(define-key dired-mode-map d symb))
  
  (multi-evil-define (kbd "j") 'evil-backward-char) ....

Re: Interactive Vim tutorial

#185
post #178
post #161

(Incoming controversial anti-Vim comment. Down voting because you disagree is a poor show and a poor argument. Convince me otherwise with words, good sirs and madams.) Vim, beyond the very basics for server side administrative tasks, isn't worth your time. Vim isn't worth the investment in time for me, as an average programmer, and I doubt it's worth the time of most other (average) developers as well. It's a big inv…

> It gives you access to keyboard shortcuts for moving around ... Your whole comment can be dismissed easily because of this one gross misunderstanding. Vim is not a bunch of weird keyboard shortcuts. If one approaches Vim as an editor that uses keyboard shortcuts that are inconsistent with every other editor out there, then one is simply setting themselves up for pain and unproductivity. Vim is not a bunch of keyboa…

It's an interactive editing language... that I'll never use and still be as productive as you.

Re: Interactive Vim tutorial

#186
post #161

(Incoming controversial anti-Vim comment. Down voting because you disagree is a poor show and a poor argument. Convince me otherwise with words, good sirs and madams.) Vim, beyond the very basics for server side administrative tasks, isn't worth your time. Vim isn't worth the investment in time for me, as an average programmer, and I doubt it's worth the time of most other (average) developers as well. It's a big inv…

I'm happy you like VSCode so much. I do too, but I don't think it really qualify as a IDE. Same goes for Atom. Unless you consider Sublime an IDE as well. It has all the features they do, mainly because they ripped it off to gain them. Putting that aside, I totally understand what you're saying about Vim. I felt the same way when I started out with it. But I didn't have a choice at the time because the company I work…

> I'm happy you like VSCode so much. I do too, but I don't think it really qualify as a IDE. Same goes for Atom. Unless you consider Sublime an IDE as well. It has all the features they do, mainly because they ripped it off to gain them.

I never said it was an IDE. At least, I never intended to say it was, because it's not.

> And now, after 3 years of learning, and tweaking, and practising, I get Vim.

It took three years to learn to use Vim to be productive, is what you're saying here. Point and case.

Re: Interactive Vim tutorial

#187
post #186

Earlier quoted context omitted.

I'm happy you like VSCode so much. I do too, but I don't think it really qualify as a IDE. Same goes for Atom. Unless you consider Sublime an IDE as well. It has all the features they do, mainly because they ripped it off to gain them. Putting that aside, I totally understand what you're saying about Vim. I felt the same way when I started out with it. But I didn't have a choice at the time because the company I work…

> I'm happy you like VSCode so much. I do too, but I don't think it really qualify as a IDE. Same goes for Atom. Unless you consider Sublime an IDE as well. It has all the features they do, mainly because they ripped it off to gain them. I never said it was an IDE. At least, I never intended to say it was, because it's not. > And now, after 3 years of learning, and tweaking, and practising, I get Vim. It took three y…

> I use VSCode, and I've found that I haven't had to leave the editor or install anything outside of VSCode plugins to make it operate as a Java IDE, Go IDE (OK, I had to install Delve), or Python IDE.

You explicitly called it an IDE.

> It took three years to learn to use Vim to be productive, is what you're saying here. Point and case.

They didn't say that. Anyone without sever learning difficulties should be as productive in vim as any text editor in a few days at most, it just takes years to master because it's capable of so much.

Re: Interactive Vim tutorial

#188
post #110
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 have been using Vim for 15 years now and I completely agree with sevensor's comment. - Vim is not newbie-friendly regardless of whether you remove guioptions or not. One has to spend at least a few hours of study and practice to get comfortable with Vim. If one is forced to invest a few hours to learn an editor, one might as well get rid of guioptions and follow other advice provided in sevensor's comment. - Learni…

I agree. I didn't really learn vim (and subsequently learn to love it) until I disabled the arrow keys in my .vimrc file, which forced me to learn hjkl.

Re: Interactive Vim tutorial

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

> Sorry, but I think that's really bad advice [...] If all you learn is to do things that are "pointless" (like learning hjkl),

I agree. For navigation I rather use f, w, e, {,}, ctrl-l, ctrl-u, /, o. I think hjkl are overrated.

Re: Interactive Vim tutorial

#190
post #185
post #178

Earlier quoted context omitted.

> It gives you access to keyboard shortcuts for moving around ... Your whole comment can be dismissed easily because of this one gross misunderstanding. Vim is not a bunch of weird keyboard shortcuts. If one approaches Vim as an editor that uses keyboard shortcuts that are inconsistent with every other editor out there, then one is simply setting themselves up for pain and unproductivity. Vim is not a bunch of keyboa…

It's an interactive editing language... that I'll never use and still be as productive as you.

Good luck living in your comfortable bubble!
Post reply on HN