Hacker News new | past | comments | ask | show | jobs | submit login
Mastering Vim in Vim (weddingpartyapp.com)
104 points by gmccreight2 on Jan 23, 2014 | hide | past | favorite | 33 comments



Are there any other modal text editors in wide use?

All others I can think of have you strongly in one mode (insertion, typing) and you only drop out of it if you hold down a command key (Control, or pull down a menu, etc.). Before GUIs it was a lot more common to have 'entry mode' and command mode in your text editor/word processor, but vim is the only one I know of now where 'insert' is merely one mode, and by default you're in a movement/command mode.

Not saying it's bad; I spend most of my day in vim and wouldn't have it any other way.


emacs + evil?

Aside from vi-emulation, I haven't seen many editors that heavily use modal editing.


For Vim mastering outside of Vim, I have found this quite pleasant: http://vim-adventures.com/


I love the idea and execution of this simply because I find making myself practice vim commands to be the hardest part of learning vim, but $25 for a 6 month limited license?

I'm all about game developers getting paid for their work, but that seems crazy overpriced to me & really turned me off of the whole project.


If you consider the price in terms of the utility you'll get out of it I think that's a reasonable price. This book[1] is recommended up the page and that's $23 minimum.

[1]: http://pragprog.com/book/dnvim/practical-vim


Right, but you get to keep the book, not give it back after 6 months.


I think it's hard to go wrong with Vim Tutor followed by http://pragprog.com/book/dnvim/practical-vim


Thanks for the link, Jacob. I'll have to check out Practical Vim. I notice it says that it has more than 100 Vim tips. I guess I would take those tips and put them into my study deck so that I'd actually be able to remember all of them. ;)


That book has been on my wish list for a while. Guess I'm buying it soon.


In sublime text you open the command panel[0] (ctrl+shift+p) and it reminds you of the key shortcuts for any given command, and you can fuzzy search the name of the command. I use modifier keys but you can use 'Vintage mode' if you want a vim-like command mode.

[0](http://i.imgur.com/oFlB8Br.png)


For me, a GUI editor is always preferred over Vim. But when I have to use CLI editors, Vim is the best.

That's why I will never master in Vim. Because files that I edit most are hosted locally


GUI editor? MacVim! GVim!

I find that MacVim is rather nice. It integreates really nicely with the graphical environment.


I suppose it depends what you're coding. For Objective-C I use xCode. For Android I use Android Studio. They provide many key affordances because they are tuned to their particular use cases.

However, if I'm writing in shell, Ruby, JavaScript, or any other oddball language without a purpose-built IDE, a well-tuned Vim setup, and extensive familiarity with how to use it, works wonders.


There's a plugin called XVim for Xcode that provides the best of both worlds IMO.

https://github.com/JugglerShu/XVim


There's a plugin called 'ideavim' for android studio (and all jetbrains editors). I use it in webstorm and intellij and it works great, gives you the best of both worlds.


Used to be the same with me. Then I got a Mac and realized that some keys are missing. My goal was then to learn how to do the stuff that I commonly do in GUI editors: edit multiple files at the same time, copy&paste code around, navigate through the file system conveniently... Googling for these things took some time but now I'm pretty fluent in vim. Also I like the workflow having vim open and then ^Z into the command line to run unit tests.


Even better than ^Z to run tests is temporarily mapping a key combination to run them. For instance, I'll do :map ,t :w\|!rspec<CR> which lets me type ,t in command mode to save the file and run the tests. Vim will show you the output of your command and then wait for you to press a key to return to Vim.


Actually, there are a bunch of plugins that will use a subshell to run this, and then bring it up when it's done so you can keep working while the tests run.

Not so important for a quick script but if your tests/compiling takes a few minutes, totally worth it.


vim is a full screen editor, not a command line editor (CLI), are you thinking of sed, instead?


I learned the most with VimGolf (http://vimgolf.com/). It's also pretty fun.


Most of the commands are suited for a en_US keyboard only, do you know a .vimrc that is optimized for a de_DE keyboard?


I learned en_US and tossed the other keyboard layouts that I had to learn before (German qwertz and later French azerty).

It was really worth it! It was difficult for 3 weeks. On Linux I use the US International AltGr Dead Keys layout, which I find very suitable because it allows me to write all the German, French and Turkish characters by composing accents on them. On Windows this layout does not exist (but the simple US which is backward compatible for all ASCII characters is there) so I had to find it on the net and install it manually.

The rational is, that in almost all non-English countries the US keyboard layout is available and you can really quickly change to it (on windows it is LeftShift+LeftAlt) if you have to touch the keyboards of your colleagues. The pre-requisite is to be able to type blindly.

I took this decision when I had to work in different countries. It was a life changing experience. If I knew it before I would never have learned azerty when I moved to France.

One problem though is to get computers with the US layout. In this regards Lenovo seems to be the only one that lets you chose the US layout.


I'm serious: Are you really comfortable with that layout? I mean, most programmin related symbols are hard to reach in my world.. I'm on en_US just because of that.


Which commands are you having trouble with? I'm using the Colemak keyboard layout and have no problems.


[ ] { } and / are harder to reach on de_DE than on en_US. I once learned the en_US layout, but after that I had problems with de_DE and when I visited Paris, I also had trouble with fr_FR, altouhgh I knew azerty and qwertz quite well.

I have never ever heard about Colemak. I use Gentoo with the KDE destop, btw.


Id say the layout of the keyboard doesn't matter. I've been using vim in Dvorak for years now and it hasn't been an issue. The 'hjkl' thing doesn't make sense, but once you get past that, it's just another set of keys to learn.


Can someone explain the last panel in the comic? Where emacs gets a spiral?


I imagine the spiral symbolizes the point past which a person becomes proficient enough to write Elisp easily. The person then realizes the infinite malleability of Emacs and begins customizing it endlessly.


Emacs uses lisp and loads of recursive functions. I imagine the spiral has something to do with recursion.


It looks like Debian's logo: https://www.debian.org/ -- but I'm not sure if it's trying to imply emacs is impossible to learn or something.


Nice post g! This is going to be really helpful.


Thanks Lou! Glad it'll help you.


I like that!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: