Live data from Hacker News

Interactive Vim tutorial

openvim.com

171–180 of 230 posts

Re: Interactive Vim tutorial

#171

I've tried learning Vim several times, but the need to switch modes and back for cursor movement has been a huge turnoff, especially considering the location of the ESC key. It seems to just conflict with the way that I type, where I am frequently jumping my cursor around in the middle of text editing, which is effortless in Emacs. Maybe mastering Vim is not just about memorizing key combos but about changing your co…

Try Ctrl-C which is equivalent to ESC in vim.

Re: Interactive Vim tutorial

#172
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 go with system wide caps lock as esc also.... it's how I think of "esc" now in any program not just vim

I also bind ALT-J and ALT-K globally to down and up arrows which is super useful when any kind of drop downs turn up and you want to select different options

I also don't use VIM the program that often, more often than not I'm using Vim bindings in other editors. Though they all have their quirks in terms of what they support.

Re: Interactive Vim tutorial

#173
post #64

Went through the tutorial, but I still don't think I really get why so many people seem to like Vim so much. The only thing there I noticed which was new to me from a functionality standpoint was the repeated commands feature. Anyone have some better examples of things you can do with Vim that make it worth learning over a GUI-based editor like Atom?

Vim is really a combo effect, it's great when the commands are second nature and you think of your editing tasks in larger chunks.

You don't have to give up Atom, you can use Vim bindings in atom. Most editors support it to some extent via plugins.

I use vim bindings in Visual Studio, and I combine it with Resharper, and that is insanely awesome. I started writing a guide to it ( https://github.com/keithn/vsvimguide ) but it needs a bunch of work, I keep changing my mind about what the best starting bindings are to get the best blend of VS + R# and Vim ( I mainly fully embrace the Vim way, but I think thats too much when starting, it's best to start with the core Vim moving/editing and then learn to customize). But I digress, the "Changing Text" section has a number of combos that people often find a selling point of using Vim.

Re: Interactive Vim tutorial

#174
post #163

Earlier quoted context omitted.

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

If you mess up the whole undo/redo sequence by typing inbetween, :earlier and :later are nice to know about too.

Oh wow. Thanks for those. I completely forgot those were things.

Re: Interactive Vim tutorial

#175
Are there any common "home row arrow key" schemes besides the Vim HJKL? Need to determine which to learn, and those 4 have never made sense to me.

ESDF and IJKL look temping

Typing in Dvorak, I'd need to remap anyway before being able to use the keys. May as well pick the best scheme.

Re: Interactive Vim tutorial

#176
post #155

Earlier quoted context omitted.

> i and ESC I think i and Ctrl+[ is better? It's more in line with the idea of keeping your hands near home row.

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.

Re: Interactive Vim tutorial

#177
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 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?

Re: Interactive Vim tutorial

#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 keyboard shortcuts. It is an interactive editing language! For more, see this excellent comment on StackOverflow: https://stackoverflow.com/a/1220118/1175080 (a very well written answer!).

Re: Interactive Vim tutorial

#179
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 at only supported Vim, and there weren't too many other options around at the time. Atom was just new and ran like a dog. We were told we couldn't use Sublime unless we bought a license, so I was stuck with Vim.

And now, after 3 years of learning, and tweaking, and practising, I get Vim. I'm not a hardcore user; I don't use hjkl, I rarely use any register apart from ", but that doesn't mean I'm not getting any benefit from Vim. There are definitely some features in those other editors that are also attractive, but I've managed to find ways to replicate them in Vim, either using plugins or by mapping commands.

That said, at home I still use Sublime, but it has been pretty awkward because my hands are so use to certain Vim things, that I find myself pressing keys, doing things I didn't intend a lot. Installing a Vim-mode plugin to one of those editors doesn't fix that.

Re: Interactive Vim tutorial

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

I cannot recommend SurfingKeys highly enough; it's a phenomenal extension.
Post reply on HN