

Ask HN: Use Vim? What Feature "sold"you? - bcrescimanno

There's been a lot of buzz lately about Vim and with projects like Janus, getting started has never really been easier.  However, when a newcomer does research on how to get going with Vim, there's a ton of duplicate information, but not a lot (at least that I've found) on what features really finally convinced users to deal with the learning curve and really dig into Vim. I find it hard to believe that using h j k l to navigate is really Vim's strong selling point and yet it's what we hear about most often.<p>The only consistent answer I've heard is that ci is a lifesaver. While that's true, I'd also be interested in hearing about what tools and tricks you've picked up that made you say, "Ok, Vim is my editor!"
======
grn
After some practice with Vim I started to _think_ about editing in terms of
Vim's commands. That made me very effective. And it's not only about h j k l.
It gives you many small tools that you can combine. The basics are actions and
movements. Let me give you a few basic examples.

Some movements are:

\- h, j, k, l,

\- f <char> \- the given character,

\- w / b - beginning of the next / previous word,

\- 0 / $ - beginning / end of the line.

Some actions:

\- d - delete

\- dd - delete whole line

\- y - yank (copy to the Vim's clipboard)

\- p - paste

\- c - change

\- <n> G - go to the n-th line.

Their combinations could be:

\- d f . - delete from the cursor to the first period

\- d w - delete the current word

\- c w - change the current word

\- d 0 - delete to the beginning of the current line

\- dd 10 G p - delete the current line (that also puts it in the Vim's
clipboard), move to the 10th line and paste the deleted one there.

Of course it gives you much more: searching, replacing, scripting, plug-ins,
syntax highlight, auto-completion, browsing etc.

~~~
bcrescimanno
Fair enough--but that's more of a "cheat sheet" than anything else, you know?
Learning the commands and committing them to muscle memory is part of the
learning process for any app. Vim is known to be generally difficult (or at
least time consuming) to learn because you have to first digest what the
commands are before you can work on getting them into muscle memory.

The question is: what features did you find that decided it was worth it to
switch? If not for the feature itself, then how does the paradigm of its usage
help you?

For example, ci{ is often cited by developers is awesome. It's so much faster
than highlighting text within curly braces and changing it so while it's a
pretty simple thing, Vim's implementation makes it a breeze to use.

------
g-wizz
I use to wonder the same thing myself before I started using Vim.

Now I'm not a Vim expert but if I had to sum up the benefits, I would say that
it allows you to keep your hands on the keyboard _and_ your fingers on the
home row the entire time when programming. It's a subtle usability benefit
that means that I can use more of my cognitive resources on the programming
logic when I don't have to take my eyes off the screen to find the mouse,
reach for the mouse, bring my eyes back to the screen, use the mouse and place
my hands back on the keyboard. This is a bigger distraction than it sounds.

I know most editors have keyboard shortcuts but for me the user experience is
just not the same as Vim's and I didn't fully appreciate this until I was
reasonably proficient at using it.

Edit: formatting

------
us
My answer is probably not the best answer here but a friend uses Vim and I was
introduced that way. I'm sure if I didn't know anyone using Vim, the chances
of me picking it up and trying to dive head first on my own into how Vim works
would be slim, albeit not impossible.

------
lylejohnson
I don't know that this answer is in the spirit of the question you're asking,
but I think anyone who does software development for a living needs to know at
least the basics of vi(m).

If it hasn't happened yet, some day you're going to find yourself logged in to
an unfamiliar Unix-y system's console and need to edit some files. You may not
be able to start X and get to your favorite GUI editor. Emacs may not be
installed and you may not have the authority or time to get it installed.
(Side question: Do any Linux distros install Emacs out of the box?) But vi(m)?
Yes, it will almost certainly be installed, and you're going to want to know
how to use it then.

~~~
bcrescimanno
I think that's a fair response; but there's a difference between "knowing the
basics" to get something done vs. using it as your daily editor.

------
anon_d
I use Vi because it decreases the learning curve for new languages. No new
IDE; no new set of emacs key-chords and mode-tricks. I can edit very
efficiently in Vi, and all of my editing tricks/habbits apply to all
languages.

Technically I use Vim, but a lot of Vim features violate my "no language
specific features" rule. So I usually restrict myself to Vi features.

------
stonemetal
First off I am a VIM noob. What makes me say I want to edit a file in VIM
rather than something else? It would have to be the search, modify, save
routine. As an example: opening an ini to change a specific value, so much
easier and faster in VIM than any other editor I have tried. Another is the
ability to use cut, copy, paste with multiple registers.

------
anthonycerra
My favorite feature is that it's around $60 dollars cheaper than Textmate.

~~~
pestaa
And still actively developed! But don't tell anyone...

------
bediger
I've been using Vim for a long time, maybe since version 3 or 4, because what
sold me was multiple windows, either into the same file, or each window
displaying different files.

------
iopuy
The first real command I learned was how to find and replace in a file:

:%s/oldWord/newWord/g

Since then I haven't looked back.

------
iuguy
I don't use vim, I use fuv - <http://secretgeek.net/fuv_intro.asp>

~~~
rick_2047
_TAKE THE FUV CHALLENGE. Use fuv as your only text editor for 1 year.

Then you will be ready for emacs._

WTF? What is it, an emacs for low self esteem people? "Hey I am not smart
enough to take on emacs directly, let me try something which is named like it
came out of the mouth of a six year old."

~~~
iuguy
It's a parody of vim, pretending to be more hardcore.

------
hasenj
I can edit without using the mouse.

You have no idea how painful it is, having to use the mouse while editing
text.

