top | item 12725426

Vim for Humans

306 points| 0x54MUR41 | 9 years ago |vimebook.com | reply

240 comments

order
[+] gbrown_|9 years ago|reply
I've only skimmed this but there seems to be a focus on customizing and plugins from the get go. I think it's worth getting to know Vim "as is" before doing such things. Indeed there certainly some things that aren't the most useful or obvious but it's good to understand their original intent.

Not to crap on the author of this but I'd recommend Drew Neil's Practical Vim over this (and pretty much every other Vim book).

https://pragprog.com/book/dnvim/practical-vim

[+] exDM69|9 years ago|reply
I kind of agree but vim's defaults are awful. Tim Pope has put together a good set of non-opinionated defaults which don't change key bindings or customize it otherwise [0]. I have a very similar vanilla setup with no plugins apart from syntax highlighting for some languages not included by default.

[0] https://github.com/tpope/vim-sensible

[+] ases|9 years ago|reply
To perhaps go against the grain a little here, I appreciate a focus on customisation from the start.

I am beginning to use Vim more, mostly because I was introduced to the keybindings with Vim emulation from other apps, and I appreciate how it works. I had previously attempted to learn Vim through the normal ways, but it just was impossible; by default, Vim for me is barely readable and none of the included colour schemes ever made it any better. Plus, of course, some of the other things like size of tabs, line numbers, often even syntax highlighting. But finding out how to deal with plugins, themes, settings, etc. is difficult when you aren't already introduced to Vim, precisely because most people make the assumption that you've learned Vim "as is" already.

I think some concession has to be made to modernity. Vim is very old and "as is" it often just doesn't function very well for everyday use. Grinding through that until you know it well enough to be given the knowledge of how to make it nicer to use isn't worth it to most people. It certainly wasn't to me.

[+] rubbsdecvik|9 years ago|reply
I can't recommend this book enough. As a long-time Vim user, I still learned a few things after reading this book. Drew Neil is a pretty awesome person too.
[+] a3n|9 years ago|reply
> I think it's worth getting to know Vim "as is" before [customizing].

For Vim and much else, I've found it worth reacquainting with "as is," after years and decades of customization.

[+] nicolashahn|9 years ago|reply
I disagree. Vim is bare, cold, and strange when coming from a traditional editor, and I probably wouldn't have gotten involved if it were not for a friend who already have a useful .vim and .vimrc for me to use as a starting point. He got me up and running with a Vundle, syntax highlighting for all my languages, autocomplete, and various settings that should have been default with stock vim. Though vimtutor was also very useful for getting used to the standard controls.

Edit: Forgot the most important thing, the setting that lets you use the mouse: set mouse=a. After I discovered this I knew I was never going back to Sublime.

[+] antipasta|9 years ago|reply
I started out trying to go plugin free since I wanted to avoid bloat, but eventually gave in once I found plugins that eased bottlenecks in my workflow with a barebones vim.

Though I love the plugins I use now, I do agree that it makes sense to be fairly comfortable in a plugin-free vim before installing a ton of them.

I wrote a blog about this topic a month or so back:

http://blog.bugreplay.com/post/149712686514/how-i-learned-to...

[+] return0|9 years ago|reply
The benefit of learning the 'default' vim becomes obvious when u have to log in to a foreign system.
[+] baldfat|9 years ago|reply
I agree and then I got a little mad. My version 1 is outdated and the updated ebook is a full price cost for me. Why are some ebook companies charging full price for revisions of books purchased?
[+] edoloughlin|9 years ago|reply
> there seems to be a focus on customizing and plugins from the get go

This is understandable. Coming from Emacs, I need an equivalent of projectile to stay productive while learning.

[+] pacomerh|9 years ago|reply
Nice, "practical VIM" is how I learned VIM. Very easy to understand given the examples.
[+] clifanatic|9 years ago|reply
I always thought that if I were ever to write a book on vim, I'd start with a thorough introduction to ed, followed by a thorough introduction to ex, finally followed by a thorough tutorial on all the features of plain-old vanilla vi, only then to introduce the vim parts and macros and graphics and things.
[+] Philipp__|9 years ago|reply
It took me a while to realize what really vim is for. What led me to realization was switching to Emacs. I read this post, and second checkbox says "modern customizable IDE". And I stopped there. Why you may ask? Well, I used Vim for 3 years before trying Emacs this spring. And I loaded it with all the heavy plugins(YCM), but Emacs led me to realization that Vim is more of an editor than IDE. Even with plugins I think it just doesn't even come close to Emacs, which has really nice ecosystem and plugins that are spot-on IDE feeling (ENSIME, CIDER, Alchemist etc). When I configured Vim again few days ago I realized how I misused Vim. My init.vim had about 150 lines of code, with few plugins, and now it felt right. Just like it felt right to customize the living hell out of Emacs. Again, this might be just my perception of things, some other people like it the other way, different flavors for different people, but it is how it felt right for me personally, after trying to understand philosophies and surroundings in which these wonderful pieces of software were made.
[+] gravypod|9 years ago|reply
I wish I could use vim or emacs. I don't know if I'm stupid or something but all of the key bindings, everything you have to remember, it just doesn't make sense to me.

I wish there was something like nano + plugins. If I had that I could implement most of what I need (other then auto-completion for a crap load of languages).

[+] olalonde|9 years ago|reply
Learning Vim is probably a bit like learning to bicycle/swim. It requires a lot of conscious effort at first but eventually becomes a second nature. Also, I doubt many vim users would use "nano + plugins" if vim suddenly disappeared. The fact that vim has many plugins and runs in the terminal is nice but isn't the main reason people use it IMO.

I second the suggestion of using vimtutor to get started (uninstalling other editors helps too!).

[+] ifoundthetao|9 years ago|reply
Vim is very easy, I think it's just simple to get overwhelmed with it.

There are a couple of tools which gamify Vim. I personally haven't used them. But some say they're pretty good.

For me, what worked was just jumping in and going whole hog. I tried disabling the arrow keys in Normal Mode, so I would have to use hjkl for navigation. But my keyboard puts the arrow keys in easy reach (Kinesis Advantage), so it turned out not to be much of a need.

What you may like is turning on relative line numbers. That way you can visually see what line you're at, and how many lines away your target is that want to jump to. Then you can practice going 5k to go up five lines, or d2j, to from where you are to two lines down.

This article was actually eye-opening for me: https://yanpritzker.com/learn-to-speak-vim-verbs-nouns-and-m...

Maybe it'll help you too.

:wq

[+] sergiosgc|9 years ago|reply
Vim takes a while to grok. You have to move away from the mindset of "memorize a lot of strange commands" to the mindset of a language for text manipulation. Then, learn the absolute minimum set of commands ([a]ppend, [i]nsert, [d]elete, [p]aste), start using, and add vocabulary gradually. Just like learning a new language.
[+] Veen|9 years ago|reply
As others have said, start with the basics and learn to use the help system. I found it enormously helpful to watch videos like Derek Wyatt's[1] that show a Vim master at work and explain the basics. It's not that I learned the key mappings from watching videos, but I did learn the potential of Vim.

Then, with a basic understanding of how to use Vim as a beginner and a comprehension of the possibilities, I paid attention to how I worked and looked for areas for improvement. When I spotted something that I could do more efficiently, usually reducing repetition, I used the Vim help and Google to find out how to do it.

A trivial example would be using the hjkl movements to go further than a couple of characters. First, I learned to move in words (w and b), then I learned to use the f and t searches and incremental searches. Then using counts to move specific numbers in whichever direction. After a month I stopped reaching for the mouse or doing llllllllllllllll to move through text.

I learned slowly: maybe adding one cool key mapping or feature to my workflow every couple of weeks. After a few months, it adds up. Soon you don't even think about it. You see what you need to do and your fingers do it for you.

Vim is a complex beast: an accretion of decades of features, most of which you'll never need. The best way to learn is by the same process of accretion. You'll start off using Vim like a non-modal editor, but if you stick with it, your patience will pay off.

[1]: https://vimeo.com/user1690209/videos

[+] dangerlibrary|9 years ago|reply
In emacs, at least, every command has a name. Anything you'd like to do can be searched using tab completion and a little guesswork, at first, by typing `alt-x` followed by the first couple letters of a plausible name for the thing you are trying to do.

It's an extremely clumsy but totally workable way to get around if you only rarely need to edit a text file on a remote server. For example, if you highlight a section of text, you can `alt-x comment-region` and emacs will automatically insert comment markers at the beginning of each line (`uncomment-region` to undo the process). Or `alt-x save-buffer` to save.

The myriad keyboard shortcuts are just aliases for the named commands, so it's a straightforward transition from the clumsy tab-complete workflow to a more efficient one once you know your way around.

[+] no_protocol|9 years ago|reply
> 3.5 Our first plugin: the file explorer

  it would be cool to be able to open
  files without having to do File -> Open
  using the menu bar
How about using the :edit command?

> 3.5.1 Plugin manager: Pathogen

> 3.5.2 The NERD Tree: a file explorer

  The NERD Tree is a plugin that will
  allow you to display your directory
  and file tree directly in Vim
> 4.1 Learning how to move

Most distributions of vim include the netrw plugin for remote and local directory browsing. Do we really need to learn how to install plugins before even learning how to navigate within a file?

This book seems to focus on the basics of vim. Unfortunately, it falls into the common trap of piling on many layers of unnecessary extras before explaining the basic details. I would not recommend this resource to a beginner.

[+] anondon|9 years ago|reply
A little background. I am familiar with vi and use it only when I ssh into a server.

But I never really felt it was more convenient or an improvement over a GUI based text editor or IDE on my development machine. Eg- gedit for simple text editing, Android Studio for android development, Atom for python coding. Everything works out of the box with minimal tweaking required.

Genuine questions:

-At what point on the learning curve do you feel using vim is an advantage for speed of development, if at all?

-The common argument of only keyboard, no mouse when using vim... I don't get. Is using a mouse such a major factor that slows you down or affects you negatively?

[+] baldfat|9 years ago|reply
My simple whys. No mouse needed is the biggest. It is like when you watch someone not use short cuts in your OS or they use mouse to select the word and then right click for copy.

diw to delete whole word.

yy then 5p to repeat the line 5 times instead of copy paste.

/ for search is really nice.

gg to go to the top or G to go to the bottom.

These things make it worth using vim for me. I use vim mode on all the editing programs (RStudio and VS Code)

[+] greenshackle2|9 years ago|reply
>-The common argument of only keyboard, no mouse when using vim... I don't get. Is using a mouse such a major factor that slows you down or affects you negatively?

Yes, it hurts my wrist. If I use it continuously for too long it becomes disabling. I use awesome window manager, tmux, vim, vimium browser plugins so that I never have to touch the mouse.

Keyboards hurt my wrists too but it's much more manageable.

I havn't measured actual speed/efficiency, but once I got used to keyboard shortcuts for everything using the mouse feels slow, clunky and inaccurate.

[+] MichaelGG|9 years ago|reply
The best comparison I have is: You know how when you are helping someone that doesn't know how to use a computer? How frustrating it is as they slowly mouse around, looking for stuff - makes you wanna just sit down and take over?

Well that's how I now feel when someone else is editing a file without Vim.

[+] exDM69|9 years ago|reply
> -At what point on the learning curve do you feel using vim is an advantage for speed of development, if at all?

Text editing is not a bottleneck in my development workflow, so I'd say never. This said, I wouldn't change to a different editor, especially one that doesn't have Vi-like modal editing.

> Is using a mouse such a major factor that slows you down or affects you negatively?

Yes and it's also an ergonomics disaster.

Vim isn't great when it comes to IDE-like features but it's a great text editor once you grok the paradigm. If you use it like a "normal" editor, it kinda sucks. Once you can keep your hands on the home row at all times, you don't want to go back.

Vim's killer feature, not found in any other editor I know, is repeat (.) .

I use vim in tmux with a curses debugger and it gets a lot of IDE benefits but is language agnostic. Changing to a different editor/IDE depending on language/target platform/project just sounds awful.

[+] clifanatic|9 years ago|reply
Well, it depends on what you're doing. For example, if I want to duplicate a line in vi, I can type 'yyp' and _bam_: duplicate line. With a keyboard and a mouse, I have to reach over, select the whole line (being careful not to over or under select), hit Ctrl+C, move the cursor down to the beginning of the next line, and hit Ctrl+V. If I want to change the contents of a quoted string, I can type 'f"lct"' and start typing. Again, with a mouse, I have to select what I want to change: if I select too much, I can back up the mouse, but if I accidentally started the selection on the second rather than the first character, I have to abort the whole selection and start over again. If I want to change each line from the current line to the next blank line to a continuous quoted string, I can type ':.,/^$/s/\(.*\)/"\1" +/'. With a mouse, I have to click the beginning of each line and cut+paste the quotes into place, probably undoing at least a couple of times because I clicked the wrong place, etc. etc.

I know, I'm talking about milliseconds (or nanoseconds) here, but when I use vi, it's just, sort of "constant", like playing the piano. I never break my rhythm.

[+] sheer_horror|9 years ago|reply
I have replied to the other commenting wondering about Vim but I will say it here as well: Learning to get fast with Vim is incredibly rewarding. It is tough to memorize everything, sure. But it's all in pursuit of speed and efficiency that become huge multipliers over your career. You use so much less hand effort, and it runs straight from the terminal which means you need fewer running applications.
[+] neokya|9 years ago|reply
This is exactly what I feel too.

After watching Bret Victor's talk https://vimeo.com/67076984, I feel like Vim way of using computers is backward. I am probably wrong because I never got proficient with Vim. Using it only when I SSH to remote server.

[+] scelerat|9 years ago|reply
It took me about six months of using vim every day to feel like I was as efficient as I had been with Textmate or BBedit (the best options available to me at the time). I was already very agile using the keyboard shortcuts in BBEdit and other Mac text editors, but now for text editing I really do prefer vim's modal style.

And yes, after having been using vim 95% of the time for a few years, it really is faster to keep hands on the keyboard instead of using the mouse. MacVim lets you point and click to position the cursor, just like any other text editor. I almost never do, though.

[+] Avshalom|9 years ago|reply
In college I used something like 10 systems on 6 networks of which I had control over 2. VIM was already everywhere, that's when it's worth learning. When ubiquity is a compelling feature
[+] fredleblanc|9 years ago|reply
I just recently switched to vim full time, maybe 4 months ago, after my existing IDE switched to a subscription model following two updates that made the software more and more buggy. I don't have definitive answers, just experiences:

1. The first two weeks were hell. It felt like learning to use a keyboard all over again. I've tried to get started with vim multiple times, leaving because I needed something faster. This time, I just happened to catch a break in work where there was no one breathing down my neck to get stuff out the door yesterday.

After two weeks or so, you start to learn the vim mindset. It's hard to explain, but vim is both a language (via movements and interacting) and a way of thinking (via modes). I'm still adjusting to all of those, but it's gotten to the point where I think of a task, attempt it with the shortcuts I know (the "language"), and 2/3 of the time, it just works.

2. Is there speed over previous IDEs and text editors? It's about the same for me, with the added benefit that I'm no longer tied to a system I have to pay for, it's cross-platform, and pretty available in most sports.

For Mac at least, there are things like MacVIM where I believe they let you use your mouse to click around. I did all of my learning from the Laracasts vim series, and I really like his approach of doing what works for you. MacVIM adds shortcuts like command-S to save instead of :w and stuff. If it works for you, cool. I took the approach that I want to learn the base system (plus plugins) because that is a more common cross-platform interface.

From using an IDE, I don't know if I'm saving time by not using the mouse or not, but I know that I can more quickly get places within the code if I know where I'm going. I assume the benefit of not reaching over to use the mouse is helping, but I can't really tell.

For me, there were other reasons, but I don't regret the switch at all. I'm still quite the novice, but I've switched to using it nearly exclusively for projects. (If I just need to quickly open a file from the Mac Finder, I double-click and something non-vim opens. I'm OK with that, I'm no purist.)

The only place it bites you is when you use vim for a while and then go back to something like Code or SublimeText and you're typing vim commands into the screen as characters. Make sure you double-check your work so that you're not pushing ":w"'s up to production. :)

[+] appleiigs|9 years ago|reply
I often code with my laptop while I ride an exercise bike. Can't use a mouse there. Trackpad is terrible when hands are sweaty. Move too much for home row, so I two-finger type. Vim is great for this.
[+] xur17|9 years ago|reply
I've been using it as a plugin for pycharm and sublime text. I still end up using my mouse for larger, more involved editing, but I find it really useful to stay on the keyboard when moving around a file.
[+] flukus|9 years ago|reply
Another feature is that it's the easiest editor to configure and extend to be just how you like it. Parsing company specific log files for example, can be done in a few lines of code.
[+] em500|9 years ago|reply
The thing that helped me most with vi(m) was this change of mindset: don't treat Insert as an alternative mode. Instead, threat the append and insert commands as any other command, just ones that happen to (often) take long arguments, and make it a habit to always terminate those arguments with <esc>.
[+] BurningFrog|9 years ago|reply
I continue to be baffled that software written 40+ years ago, to deal with constraints and realities that are long long gone keep being used by people on the cutting edge of technology change.
[+] Animats|9 years ago|reply
What Vim, and a lot of other programs, really need is a single plastic-covered card which tells you how to use the program. You can squeeze a summary of calculus on one such card. Is it too much to ask for software?

(I really, really want that for Blender. The Blender hotkey document is 9 pages and years out of date.)

[+] coleifer|9 years ago|reply
Oh, "for humans"... It was cool when requests came out and it made sense to the audience (Python people familiar with the standard library). But it gets applied to so many things these days that it's just corny. I suppose most people using it intend to convey a folksy, whimsical, self-conscious style. It's supposed to make the content seem approachable.

The folks behind the "Head First!" series seem to understand the appeal of making content approachable. So did the creators of the "For Dummies" series. Hell, Reagan used jelly beans.

It feels dishonest, somehow. Just call it a vim book, or whatever.

[+] fasteo|9 years ago|reply
I am old enough to know vim pretty well and I guess I do not need the e-book, but I just wanted to congratulate you for the landing page: clear design and better content. I just love the pitch "How do I quit this @#!?"
[+] atemerev|9 years ago|reply
Just paid 3.5 euros and haven't got the book, site said page doesn't work :(

My e-mail is sorhed at gmail

[+] AdmiralAsshat|9 years ago|reply
2.1 For who?

If the author is reading this, proper English would be "For whom?" The intro says he's not a native speaker, so it's a common mistake. Easily fixed.

[+] anotheryou|9 years ago|reply
Anyone using vim-mode plugins for other IDEs? Most vim critic in the comments seems to be against it as an IDE, while the biggest benefit is obviously the keyboard control. So why not use the combination of both (I installed plugins for Visual Studio and Atom a few days ago and I'm quite happy so far, but it's my first steps in to vim, so maybe I'll find things that won't work later)?
[+] Hydraulix989|9 years ago|reply
vim for humans is nano -- you shouldn't have to read a book to learn how to use a text editor.
[+] rublev|9 years ago|reply
Wow this site doesn't work at all. I clicked on the "download the ebook" and nothing happened. Scrolled down, entered $0 and I get a blank page. Anything above $0, credit card form works fine.
[+] Rainymood|9 years ago|reply
The very first thing I do on any default Vim config is

    :imap kj <Esc>
And then Vim kinda makes sense to me. Pressing <Esc> each time is such an anti-pattern imho.
[+] creamy|9 years ago|reply
A wiseman once told me: "If you have to hold a key to reach your goal, there is probably a better (i.e. shorter) way to do it."