Live data from Hacker News

Two Simple Steps Helped Me Learn Vim

adamdelong.com

61–70 of 92 posts

Re: Two Simple Steps Helped Me Learn Vim

#61
post #57

Earlier quoted context omitted.

Your example falls flat. Any text editor with regular expression support can do that... Do you have another example?

vim: step 1: type ci(. step 2: type what you want to replace with. step 3: press ESC. notepad++: step 1: press Ctrl-H. step 2: type \([^)]*\). step 3: press tab. step 4: press (. step 5: type what you want to replace with. step 6: press ). step 7: move hand to mouse. step 8: move cursor to and click on "Regular expression". step 9: press enter. Do you have another example?

Not implying that the vim way isn't faster but on any regular text editor you can:

ctrl+right arrow once or twice, right arrow to skip the (, shift+end, shift+left arrow, then type.

Re: Two Simple Steps Helped Me Learn Vim

#62
Interesting post!

I found another way to improve my vim skills and memory was to simply write a wiki page with all the shortcuts / key strokes I learned or used. It has a big benefit for me of anchoring things in my memory.

Always having it open when in vim, referring to it often, adding things, moving things, reorganizing categories was a huge benefit for me.

Here is a screenshot of my wiki page index:

http://imgur.com/my7lJJG

Also, having ones' dotfiles synced on github can be highly beneficial as your vim env / plugins will be consistent between desktop / laptop / office / friends' place.

[Edit] - cosmetics

Re: Two Simple Steps Helped Me Learn Vim

#63

Earlier quoted context omitted.

For me, I was always annoyed with how tedious it was to edit things. i.e, The gap between what I think vs what I have to do in the editor to get it done. This constant annoyance was what drove me to spend time and energy into learning it. I believe that if you don't care about it, you won't really benefit out of it. Because the whole point of switching to Vim/Emacs is to minimise the gap between what you think and ho…

Your example falls flat. Any text editor with regular expression support can do that... Do you have another example?

The reason why it's interesting is it is basically a grammer for editing text. It's simple enough that you can easily create new strings of grammar which do what you want but powerful enough that the skill ceiling is practically infinite. Once you have a grammar for editing text a lot of interesting features fall into place quite naturally like having 'undo trees' instead of just linear undo, being able to write complex macros in the same language you edit text in, etc...

Re: Two Simple Steps Helped Me Learn Vim

#64

Here are some more tips: - disable arrow keys - turn relative numbers on by default - force yourself to only move vertically using relative numbers - force yourself to only move horizontally using [fF,;]

- disable arrow keys - force yourself ... - force yourself ... This strikes me as an attitude that drives people away from Vim. Maybe it depends on individual differences in learning style, but I would say the exact opposite. Embrace the arrow keys! And all else that is familiar. The moment you start with Vim you're diving in the deep end and productivity will take a plunge. At least training wheels like the arrow ke…

Agreed - I use vim heavily and also use arrow keys (when I can) and when they do not work for whatever reason i fall back to HJKL.

For me my main blocker was just purely not being able to use it for the absolute basic operations. I found that once I learned how to do the absolute basic (insert, copy, paste, move around, search, etc.) I was able to use vim. The next step was building my own vimrc with some very basic configurations that made vim much easier to use. Then whenever I need or want to do something complicated I just google for the command, plugin, or write my own plugin.

Re: Two Simple Steps Helped Me Learn Vim

#65
post #47

Time and again, these "how to coerce yourself into learning this hostile tool called vim" posts appear. I read them, and it sparks my interest. But usually, whats missing is part 2, which goes: "... and this is why it was so totally worth it". An no, just because it works over SSH and is installed on every server is not quite sufficient. Also, are you programming in a script language or a .NET or JVM behemoth?

I think that it is necessary to learn Vim not because it is the best text editor (it's not!), but because it is one of the best ways to edit texts. It was hard for me to get used to it (I forced myself to write all scripts - Perl, Bash etc. - in Vim). But it was absolutely worth it. Now I use vim mode in browser, in huge Java IDE (Idea), in file manager etc. Vim (as an editor) has many disadvantages (Google it). But…

Interesting - so IDE + Vim mode would be the best of both worlds. Do you find there is a lot lost in translation, or does that feeling carry over well? I'd be especially interested in Emacs and IDEA.

Re: Two Simple Steps Helped Me Learn Vim

#66
post #57

Earlier quoted context omitted.

Your example falls flat. Any text editor with regular expression support can do that... Do you have another example?

vim: step 1: type ci(. step 2: type what you want to replace with. step 3: press ESC. notepad++: step 1: press Ctrl-H. step 2: type \([^)]*\). step 3: press tab. step 4: press (. step 5: type what you want to replace with. step 6: press ). step 7: move hand to mouse. step 8: move cursor to and click on "Regular expression". step 9: press enter. Do you have another example?

And of course, \([^)]*\) breaks if you have foo(bar(), x / (y + 1))

Re: Two Simple Steps Helped Me Learn Vim

#67
post #47

Earlier quoted context omitted.

I think that it is necessary to learn Vim not because it is the best text editor (it's not!), but because it is one of the best ways to edit texts. It was hard for me to get used to it (I forced myself to write all scripts - Perl, Bash etc. - in Vim). But it was absolutely worth it. Now I use vim mode in browser, in huge Java IDE (Idea), in file manager etc. Vim (as an editor) has many disadvantages (Google it). But…

Interesting - so IDE + Vim mode would be the best of both worlds. Do you find there is a lot lost in translation, or does that feeling carry over well? I'd be especially interested in Emacs and IDEA.

I've typically found that vim impersonations miss at least a couple features that I use regularly. I've heard that Evil, in particular, is pretty complete though.

Re: Two Simple Steps Helped Me Learn Vim

#68
post #56
post #24

A more elegant solution than a notecard may be using a vim cheatsheet wallpaper, like this: http://vimfoo.com/2012/09/vim-shortcut-wallpaper/ The downside of that is that it isn't customizable, so I get why he likes the 3x5 card. But at least you can't lose this.

"Awesome! With my vim cheat sheet wallpaper I will never forget anything ! This time next year, Rodney..." "Oh..."

+5 points for using that reference on Hacker News.

Re: Two Simple Steps Helped Me Learn Vim

#69

Interesting post! I found another way to improve my vim skills and memory was to simply write a wiki page with all the shortcuts / key strokes I learned or used. It has a big benefit for me of anchoring things in my memory. Always having it open when in vim, referring to it often, adding things, moving things, reorganizing categories was a huge benefit for me. Here is a screenshot of my wiki page index: http://imgur.…

Would you be willing to share the HTML for your wiki page?

Just looking at the table of contents, it seems really useful for those of us trying to learn vim compared to the normal cheat sheet that looks like a periodic table...

Re: Two Simple Steps Helped Me Learn Vim

#70
post #20
post #13

I'm only using Vim for server-side config editing. And then a good full-fledged IDE for any large software development tasks.

The two aren't completely mutually exclusive. There are Vim emulators for pretty much every popular IDE out there.

That's also how I've been doing it for some time now - best of both worlds!

Sometimes it can get a little flaky though as recently there were some glitches in the IdeaVim plugin and it hurt my productivity badly (I'm so much faster in Vim mode). The issues have fortunately been fixed by now.

I had always been struggling with Vim for bigger projects because I had to waste many good hours over highly individual sets of dotfiles with plugins like Nerdtree and others (integrated debugging, jumping to function definitions etc) I could have been programming instead... IDEs like Xcode and RubyMine are tightly integrated with their domain out of the box so to me there is not much I could rationalize about in terms of using Vim (unfortunately).

I even picked up WebStorm for node/js/html development recently, naturally with the IdeaVim plugin activated at all times :)

Post reply on HN