
Why I can’t stop using Vim - gcmalloc
http://www.kornerstoane.com/2014/06/why-i-cant-stop-using-vim/
======
manish_gill
I spent this entire weekend setting up Evil mode for Emacs, in the Emacs
Starter Kit package. It's been decent so far. Evil mode is surprisingly good,
and I really don't think it could come any closer to vim emulation for Emacs.
Took a lot of googling around to set up some basic plugins that I need -
projectile for CtrlP etc. I think the only thing that I need atm is Magit
integration with Evil and I'll be good to go.

What has been amazing so far is that even after using vim for almost 3 years,
I'd been sort of afraid of diving deep into the config system (I made do with
copy-pasting some popular vimrc files) and it was good enough, but in the
short span of 2 days, I've actually gotten to know more about emacs
configuration style than I ever did about vim. And I suspect it will only get
better as I start to learn Emacs Lisp.

~~~
bphogan
Do you happen to have some resources you can share? I've been playing with
Tidal, a live-coding library and it wants me to use Emacs, and I just...
can't. So any info on setting up evil-mode would be great, especially since
it's fresh in your mind. I've found some resources but really don't know where
to start.

~~~
irahul
What problems are you facing? Setting up evil mode takes just what the emacs
wiki says.

1\. Install emacs. Start emacs. "Alt-x package-install" press enter "evil"
press enter.

2\. Open your .emacs or .emacs.d/init.el.

    
    
      (require 'evil)
      (evil-mode 1)
    

Done.

~~~
aidenn0
Biggest problem for me when I first used evil was learning that C-g is what I
need to press when I accidentally hit an emacs chord sequence and want to
abort. I had to google a few times to find that out when Esc wouldn't get me
out of the minibuffer.

------
gnuvince
I don't really understand the comment about etags; if you use ctags in Vim,
you'll get the same kind of functionality. If you want something more
advanced, Emacs has support for cscope and GNU Global which give you more
features. Considering that he's interested in having something better than
VimScript and wants org-mode, it seems that Emacs + Evil would really be the
best fit for him.

~~~
farresito
I've never had any problems with etags, either. I've always gotten the same
functionality as vim. Maybe we are missing something.

~~~
falcolas
I had this same problem: they function differently in evil mode than Emacs
mode; for some reason evil does its own word boundary definitions for etags
lookups, and it breaks up words on underscores. I dug into it, and it was some
problem with evil's word semantics (that only existed for etags lookups). I
ran out of energy to debug it further, and just went back to Vim.

Regular etags called with the emacs bindings worked just fine, but switching
contexts from evil mode was a pain.

~~~
kornerstoane
Thanks for quantifying it for me. I never dug in deep enough to figure it out.
It always just felt "wonky" when I used. (That's an opinion, of course.)

------
bnegreve
I use a text editor because using a text editor that you've mastered is
pleasant. (I'm an Emacs user fwiw.)

I think we should stop trying to rationalize this choice.

Or rather, we should realize that we like text editors because we went through
a long training and acquired complex skills which are fun to put in practice.
Being a power user of Emacs or Vim is is satisfying, the same way mastering a
video game is satisfying.

~~~
tomphoolery
If that is so, why do people change text editors? (I agree with you, I just
wonder this myself)

~~~
doorhammer
I'm only speaking for myself with the below. ymmv of course

I get the "grass is greener" feeling sometimes, so I go looking to see if
anything better has come along.

Then there's just the practical switch. My main job is in .net right now,
while my home computers are all linux distros. It's made me search through a
lot of editors to find something that runs well and feels good with windows.

I also just like to explore software, you know? A for instance would be
Sublime Text. I've said it in a few other threads, but I do dig some of the
features in ST2. They really did multiple cursors right. It's a really simple,
but intuitive and powerful way to edit things. Using that on ST2 me want it
everywhere else, and also made me fall in love with how they set up the
command palette. Using emacs for a bit made me really dig how elisp worked.
Light Table showed me another take on the integration of a language into the
editor itself. So it's a lot of curiosity with that, and to know what's out
there.

As an aside, if Neovim delivers it's promises, it'll probably solidify vim
even further as my only editor of choice, but I'll still go looking around to
see what other people are coming up with.

~~~
alwillis
Haven’t installed this yet, but it looks promising for multiple cursor support
for Vim: [http://vimawesome.com/plugin/vim-multiple-
cursors](http://vimawesome.com/plugin/vim-multiple-cursors)

------
farresito
I suffer from the same thing. I've gone even futher: I've customized my tiling
wm to work with the vim keybindings; my file manager also works with those
keybindings; I use vimperator, a firefox plugin, that has those keybindings...

There's a lot of stuff that I wish were better in vim, but, at the end of the
day, it gets my work done better than anything else out there, so I don't have
any reason to move away from it. It works amazingly well with tmux (otherwise,
I would be using emacs + evil -which I actually use for Clojure-). And I'm
pretty excited about neovim :). They are doing an outstanding job.

~~~
hyperion2010
Yep. Pretty much every piece of software that I write for myself or use I
write or customize so that it has vim style modes and keybindings. Keyboard
input is still the highest bandwidth human computer interface (voice can't
quite make it because error rates mean that the bandwidth actually ends up
being lower), and modality is an excellent way to reduce complexity and
provide simple cues that make it easy to compartmentalize and remember lots
and lots of useful commands.

------
disputin
"/ for searching (really, no other editor has made it this simple)" Well, it's
really esc-/ which is no easier than ctrl-f. Or am I missing something?

Edit:

Same with "1G to go to the top of the file, G to go to the bottom" \-
esc-1-shift-g vs ctrl-home. Same with ctrl-end.

~~~
nakkiel
I think you're using the editor's modality wrong.

ESC is not used to exit from Insert mode. ESC is used to switch from any mode
back to Command mode. In fact Command mode is also called Normal mode. You
should spend 95% of your time in Normal mode and use the other modes when you
need them.

I suggest binding `kj` to ESC since it allows you to quickly make a change and
continue browsing your code. Take the following session:

* Browse and spot something that needs to be changed

* Type `ci(messages, callbackkj`

* Keep browsing with `hjkl` as you're in Normal mode

While it may seem weird, I've yet to find an occurrence of `kj` in a program
in years of using this binding and my hands haven't left the keyboard. The
cognitive weight is zero as well (at least after building muscle memory).

Now, I believe it depends on the kind of programmers you are. My coworker is
the kind who types in a lot of code and rewrites a lot of stuff. I'm the kind
of rewires things and make subtle changes after spending a lot of time reading
it. In other words it works well for me but probably wouldn't for him.

~~~
StavrosK
Interesting coincidence, I was pasting a production certificate into Vim the
other day and it contained "kj", which escaped the editor and ate a few
letters until it reached an "i" and continued pasting.

It took production down for 30 minutes until I noticed it. Remember, kids!
":set paste".

~~~
jnetterf
"+p will paste the system clipboard.

~~~
StavrosK
No way!

I just tried it, it doesn't work :( That's too bad.

~~~
tybenz
That's for GUI Vim. If you're using Terminal VIM you can install this plugin:
[https://github.com/kana/vim-fakeclip](https://github.com/kana/vim-fakeclip)

~~~
StavrosK
Thank you, I'll try it right away!

------
noelwelsh
Funnily enough, I'm going to other way: long time Emacs users, getting closer
to switching to evil-mode (Vi emulation in Emacs). Doubt I'll ever leave Emacs
though.

As an aside, how does one keep up with Emacs package development? There is
lots of stuff that's new to me (e.g. I just found out about company-mode). I'd
like to have some way to have this information pushed to me, rather than
having to go searching.

~~~
S4M
You may want to check r/emacs on reddit. People discuss about new packages
there. If someone knows other resources, please let me know as well.

------
cm127
First you'll learn how to orientate around text quickly using normal mode,
then you'll start playing with tabs, splits and buffers to search between
multiple files, and then you'll start using registers to save phrases and
regular expressions to search directories. At that point you'll never want to
leave Vim again.

:wq

~~~
beaumartinez
:x

(It's the same as :wq, but one character shorter.)

~~~
philsnow
Even shorter:

    
    
        ZZ
    

"Shift z z" is one key shorter than "shift colon x enter"

~~~
virtualwhys
Colon? That sounds painful, map it to some single keystroke. I use back slash
on my tiny cherry keyboard.

    
    
        noremap \ :

~~~
philsnow
Isn't backslash the default <leader> keystroke?

~~~
virtualwhys
yep, have leader mapped to space ;-)

------
scelerat
I've learned to love the modal nature of vim, or rather, the notion that text
entry ('insert' mode) is merely one aspect of manipulating text. The
combination of movement of commands is very powerful and these days I feel
naked when I use editors without this ability.

My first dedicated text editor was BBedit (when it was still freeware), and
for many years had extended experiments with other editors, always eventually
returning to BBEdit. Something about it always clicked with me, and I felt
like Siegel and co. fundamentally understood both the Mac and the needs of
programmers.

These days I keep BBedit around for its excellent diff tool, syntax-
highlighted multi-file grep search and replace, and its decent project
browsing. But it's mostly a supplement to vim (MacVim), which I use all the
time when I'm actually in there editing text.

------
VLM
One feature he missed is its not as configurable, and in some situations that
is awesome.

So you're doing something weird, manually, but I repeat myself because if it
was BAU you'd automate the whole process in puppet or similar. The local vim
will work more or less like every other vim out there. Can't really say that
with emacs.

If you're traveling somewhere weird, vim is a great travel companion. Not
because it can be compiled anywhere (lots of editors can be compiled anywhere)
but because it works the same anywhere.

~~~
kornerstoane
I think Vim is potentially as configurable as Emacs, but it is harder to do
after you get past some basic key mappings and a few plugins.

In all my exploring of Emacs, I never saw a .emacs that wasn't completely
tricked out with custom stuff that only works for that user.

Because of this, I believe you are correct - it's easier to work in a plain vi
environment since we don't typically trick out Vim like our fellow Emacs users
do with their environment.

------
bokchoi
Yay, I'm glad J got a shout-out even if it is one of the rejected editors.
I've loved using J in the past and have even made a few releases of J on
sourceforge [0]. I've attempted to move to github as well [1]. Sadly, I
haven't found much time to work on it -- paid work and family take precedence.
Oh, and I too love using vim as well.

    
    
      [0] http://armedbear-j.sourceforge.net/
      [1] https://github.com/kevinkrouse/j/tree/master/j

------
geoka9
> and ‘Esc’ to move around again.

For me personally this is the reason I stopped using Vi(m) except for
occasional config file editing on unfamiliar servers, and started looking
elsewhere (Emacs) for my goto text editor. I'm not looking to switch, but it
genuinely interests me how Vi users put up with the constant need to strain
their pinky to switch to command mode.

~~~
dominotw
I remapped it to 'jk'. I don't think I've seen any vim users using 'esc' key
to go to normal mode.

~~~
swah
Then the single 'j' becomes slow...

------
RichardFord
I can't stop using vi key bindings, whether that's Evil for Emacs, VsVim for
Visual Studio, the Intellij one, Sublime, etc..

But my days of using straight Vim are over. For a straight text editor, I
finally got over the hump with Emacs recently, and I'm not going back.

------
danford
I went back to Sublime after using Vim for a while but then realized I was
going to have a terminal open 24/7 anyway so what's the point? Then I learned
how to use a terminal multiplexer and now Sublime and other GUI editors just
hinder my workflow. IMHO if you're a programmer you should know how to use a
terminal to the point that you prefer it over most GUIs (of course, you should
always use whatever has the feature you _need_ ).

Oh, and on a side note:

Vim and terminal usage _is not_ a "time sink" and it pains me whenever I hear
people who consider them selves "programmers" claim it to be. If you haven't
learned how to use the terminal yet (or haven't found a use for it) then you
aren't a respectable programmer IMHO. I would not read a book on programming
by someone who doesn't know how to use a terminal and I would not take a class
on programming taught by a professor who doesn't know how to use a terminal.

~~~
Dewie
I'm not a seasoned user or anything, but I prefer to use Emacs with a GUI
rather than in the terminal. It has nothing do with there being more GUI-type
things in there - I have things like save-icons etc. turned off. It just feels
more like it's own application in GUI mode (if I run it in terminal mode, the
Meta hotkey doesn't work as usual, which I suspect is because the terminal is
using the alt-key (meta) for something else and so it overrides that hotkey).
Why should I prefer to use Emacs in terminal mode? I am honestly open to
changing my mind.

~~~
yulaow
The only advantage I know for using emacs in terminal is that you can get used
to it when you'll have to ssh into a remote server.

Anyway today we can just sshfs and use even a random ide for everything so...
we can do as we like.

~~~
hamburglar
In my experience, any sort of filesystem remoting a la sshfs simply doesn't
perform well enough to do real editing work in. One of the really nice things
about vi is that it was originally designed for low-bandwidth situations, so
using it over ssh is quite snappy even on a marginal network. If I had to use
sshfs from home to edit files on my production servers I would probably have
to kill myself.

~~~
dllthomas
I agree. I can comfortably get seconds ahead of what's displayed on my phone,
when needing to fix something in an area of poor coverage. Knowing my ASCII
chart can come in handy, on the limited phone keyboard, though...

------
alwillis
It’s great that people are so inspired by Vim that they continue to create new
plugins, tutorials and websites like Vim Awesome:
[http://vimawesome.com](http://vimawesome.com)

~~~
kornerstoane
Thanks for the link. I checked it out today and was finally able to convert
from pathogen to Vundle. The site gives you the exact strings to configure the
plugins in all the major plugin managers. IIRC, it scans github looking for
.vimrc files and indexes them to gather usage data. Very cool.

------
spacemanmatt
Even now that I'm practically married to SublimeText, I can't stop using
classic mode and I still sometimes end up in vim by force of habit.

------
dominotw
>q to record a macro; @ to execute it again

Is using macros' really common? I haven't yet figured out in when and where to
use macros during my workflow.

~~~
kornerstoane
I do a lot of work on multiple rows/sections/blocks of similar data. My
workflow usually goes like this...

1\. Do the same thing 3 times, realize that I'll be done faster if I automate
it. 2\. qz to record a macro into buffer z. 3\. Do the work, taking care to
leave myself in a state where the next invocation of the macro will pick up
right where I want it to. 4\. q to finish recording. 5\. :map <M-f12> @z to
execute buffer z 6\. Hit Alt-f12 over and over until I'm done.

Seems like a lot of steps, but it has saved me tons of time.

Of course, as the other commenter said, some folks don't use the feature.
That's ok. There's room for all kinds :)

~~~
irahul
> 5\. :map <M-f12> @z to execute buffer z 6. Hit Alt-f12 over and over until
> I'm done

Why map? @z and @@ till your are done? Or if you have this in your vimrc:

    
    
          vnoremap @@ :normal! @@<CR>
    

@z, visual select, and @@.

------
read
What I never heard explained in one sentence about vi is: why have multiple
modes? Why not zero modes instead?

~~~
DougBTX
Multiple modes allows the same keys to do different things in different modes,
there isn't much more to it than that.

Say, at a Bash shell prompt in a terminal window, pressing Ctrl+R starts
"reverse command search" mode, so that pressing letter keys searches for
commands entered in the past, rather than entering a new command. In this
mode, up and down move through search results, rather than moving through the
entire command history like in "normal" mode.

Lots of software has modes, the unusual thing about Vim is that they have
names, and that there is a mode with a focus on navigation.

~~~
read
Why have a mode focused on navigation? Is there something this mode allows
beyond navigating? What would be impossible to do if you didn't have this
mode?

The keyboard allows you to navigate too, without the need for a mode.

~~~
read
I interpret it as a positive sign when someone downvotes without an
explanation (live above). It's a sign they don't understand a topic well
enough to refute its main point. I'm sorry if the comment above also caused
you to grow indignant.

A better response would have been to zoom in at the main argument and say the
most important thing there is about it.

If you aren't downvoted enough you are probably not revealing anything
controversial.

~~~
dang
Please don't post about being downvoted on HN. As the site guidelines say, it
never helps and makes for boring reading.

Downvoting happens to everybody, and most unfair downvotes are corrected after
a while by other users, rendering the complaint even more pointless.

~~~
read
_it never helps_

I'm not sure how true that is and I might be able to prove it.

(1) One way it could help is: if I could get feedback about where I went
astray. That's what I want to know when I'm downvoted. I don't care about a
karma point, I care about learning something new.

Which makes me wonder: would it help to ask people explain _why_ they
downvoted something -- even if their username doesn't get attached to an
explanation that becomes public?

(2) Here's an instance where it actually helped: [1]. Me explaining in [2] why
[1] was downvoted (which was at something like -1 at the time) lead into [1]
being voted again and [2] being upvoted too for clarifying the situation.

(3) This comment is aligned with HN's own request for providing feedback about
what's good and bad for HN comments [3].

(4) You should be alarmed when you see a guilty word like "never" used.
Particularly if you are the one using it. It's an alarm that indicates you are
going to an extreme to justify a position. If what you say is evidently true,
you wouldn't feel the need to try hard to qualify it. Or at least, when I made
this argument in [4] people voted 20 points for it (which you dang can verify
as an administrator).

(5) These arguments suggest reviewing the site guidelines and it's hard to
dismiss them as useless. They could improve HN.

[1] -
[https://news.ycombinator.com/item?id=7285865](https://news.ycombinator.com/item?id=7285865)

[2] -
[https://news.ycombinator.com/item?id=7288741](https://news.ycombinator.com/item?id=7288741)

[3] -
[https://news.ycombinator.com/item?id=7605973](https://news.ycombinator.com/item?id=7605973)

[4] -
[https://news.ycombinator.com/item?id=7565441](https://news.ycombinator.com/item?id=7565441)

I fully understand if what you've discovered studying downvotes is that
dealing with them differently leads into more problems than it does dealing
with them with the advice of "don't post about being downvoted". I also
understand if you are not willing to deal with those problems now. But saying
"it never helps" sounds far fetched. You are claiming there's nothing that can
be done about downvotes, ever. That's a strong claim to make, especially in a
field that's only 50 years old.

------
arooaroo
I know this is a minor point but using 'gg' to move to the first line is
easier than '1G'.

~~~
adolph
The author started in vi, which has no gig as far as I can tell.

~~~
a3n
And I use :0, which is consistent with :N to get to the Nth line, which I also
use. (I know, :1 same, just my habit.) And I could use :% to get to the last
line, for more consistency, but G is my habit there.

Many ways to edit a cat.

------
icantthinkofone
It's unfortunate that, to me, the title implies there's something wrong with a
person who still uses vim and nothing could be further from the truth.

~~~
edanm
Oh c'mon. Us vim users are seen as "those crazy people" by the majority of
other programmers, and they have at least _some_ point :)

~~~
broodbucket
I am the only person in my office that uses Emacs. Everyone knows vim.
Everyone loves vim. You think you're the crazy one?

~~~
edanm
Jokes aside, outside of certain areas which are fairly unusual, most
programmers have never used vim OR emacs and I would guess that most don't
even really know about them. It can be hard to imagine in the echo-chamber
that is the online tech scene, but really most developers just use IDE's and
get on with life.

~~~
alwillis
What I’ve noticed in the Boston/Cambridge area is a resurgence of interest in
Vim. I’ve been to companies where they are intentionally using Vim and not an
IDE, even though they could. They have repos on GitHub (like
[https://github.com/thoughtbot/dotfiles](https://github.com/thoughtbot/dotfiles))
where everyone pulls down the standard Vim and other dotfiles and goes from
there.

