
Towards a Vim-like Emacs - pmoriarty
http://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-config.html
======
dima55
From the article:

"Any time you are pressing two keys at once, with the same hand, hundreds of
times per day, you are setting yourself up for repetitive stress injury"

People: learn to type. One hand for the modifier key, and the other hand for
the other key. This is why there are two sets of modifier keys. This is typing
101

~~~
Myrmornis
People: don't learn to type.

Seriously, I know this won't appeal to everyone, but there is a solution to
worrying about key combos causing RSI. Just don't touch type. Do embarrassing
hunt-and-peck typing. I'm a professional programmer and long-time emacs user
and I can't touch type for shit and it doesn't affect my career and my hands
and wrists have been completely free of any trouble whatsoever (to current age
of 36). If hunt-and-peck leaves you typing slower than you can design software
solutions in your head then find a more challenging job.

~~~
Derbasti
Ugh. I met your type. Single-letter variable names. No documentation. Because
typing more would consume too much time. No thank you.

Edit: Not _you_ , particularly. But I have met bad typists, and that is how
many of them behaved. Don't be that guy.

~~~
vithlani
What bullshit.

I can't touch type but my code reads:

    
    
      def snmp_command(session, oid, media_servers):
        result = list()
        for host_name in media_servers:
            snmp = SNMP_CMD.format(host=host_name, oid=oid)
            snmp_reply = [x for x in session.cmditer(snmp)]
    
            if len(snmp_reply) == 0:
                log.warning("No data for EMS Media Server SNMP cmd {0} for host {1}".format(snmp, host_name))
                continue
    
            # add the Media Server host from which we got this reply to the list of snmp reply
            snmp_reply.append(host_name)
            result.append(snmp_reply)
    
        return result

~~~
Derbasti
As I said, not _you_ , particularly. But bad typists exist, and they tend to
want to type less, which leads to code that is worse than it could be.

That said, where's your docstring? Why are your lines longer than 80 chars?
Why is your indent 2 chars instead of 4? What does `oid` mean?
[http://legacy.python.org/dev/peps/pep-0008/](http://legacy.python.org/dev/peps/pep-0008/)

------
erikb
I haven't seen any comment discussing it so here is kind of a vital question:
Why would I want to do that? I don't need vim to me more configurable. Just a
few weeks ago I looked into vim plugins for the third time into my vim
history, but again I found it unnecesary. Most plugins don't improve at all
what I want to do with vim.

Examples: Prettier status line? Don't need it. Tree view of my project? Don't
need it, or I use the shell command called tree. Autocomplete? I started
learning the APIs of the tools I use because it makes my writing code better
and much, much faster. Therefore I don't need that anymore. Git integration?
Why would I want that? ":!git" is fine. The sorround plugin would be an idea,
but it's key usage is strange in my eyes.

Not spending this time into individualization and instead using this time to
learn more about vim has significantly increased my code generation and allows
me more easily to work on other systems with the same efficiency as on my own.

If you have some real arguments for plugins I am really, really curious to
learn what they are. But please consider before writing if spending the same
time into learning how to solve your problem with vim capabilities would not
be the better and faster approach.

~~~
bad_user
As both an Emacs and an IntelliJ IDEA user, I wouldn't mind the lack of
autocomplete, but I do mind the lack of features for ... debugging,
documentation and quickly jumping at definitions, including those in other
people's projects that I import as dependencies. I ended up reading a lot of
source-code that way.

Emacs' ability to open REPLs and work with those, with a neat workflow (e.g.
you edit text in your file, then press a shortcut to reload the REPL or maybe
just send the expression under the cursor, is definitely nice, since it's very
interactive).

It's also nice to have good Git integration. I can select any fragment (like a
function) and quickly go through its history. I cannot do that easily with
":!git".

Emacs can also do a lot of things related to editing text. For example I use
Org Mode for managing my tasks / TODO lists, whereas other people use Trello,
or Google Keep, or EverNote or other apps that lock you in and that never do
what they are supposed to do. A TODO list is a freaking text file and having
the ability to manage that from within my favorite text editor is surely a win
and hey, I can also synchronize that in the cloud. Because really - here it
isn't Vim vs Emacs anymore, but Emacs versus your browser's TextArea. Get it?

~~~
erikb
I appreciate your detailed comment. It gives me the chance to see it from an
Emacs point of view.

Starting repls is a great thing, I have to admit. I can do that partly by e.g.
':!python -i -c "whatever"' but it's not really integrated.

I also love to do "other" things in text files instead of websites, because
text files allow you to do anything with it. Automated tasks, reformatting,
compiling to other formats like diagrams, storing in the cloud, or a repo, or
simply adding it to an email. I don't see why I need plugins or special modes
for it, though. I think that's more an argument for learning text editors in
general. No matter if you use vim, emacs, sublime, or maybe atom, in any case
you gain a huge advantage over people who can only be efficient inside a huge
IDE or their web browsers.

The other things like debugging, documentation generation, etc are in my eyes
not tasks for a text editor. I expect to do that in the shell and it works
there. Jumping to definitions is possible in Vim btw. Under the hood it
integrates with ctags which is a typical tool to index code definitions, I
think (or does it only exist for vim?).

The git example, in my eyes, is perfect for what I meant, though. You can't do
some things as directly or easily with ":!git" but that also works the other
way around. No plugin enables you to do everything you can do with ":!git" and
I bet if you write git aliases for what you want to do, you can nearly be as
efficient in the things the plugin can do. The added cost is that you need to
write them yourself. The added gain is, that you learn to use git better and
you can even use the aliases when you are not in vim.

~~~
bad_user
Emacs' Org Mode gets you hooked once you get used to it :-)

For example it can track the time it takes to work on a task and it can easily
hide/show descriptions. So it goes beyond simple text editing. Of course, I
believe it has been ported to other text editors. At least I know there is a
port for Sublime Text, but it's incomplete and much less capable. Vim probably
has a port too, but then if you end up customizing Vim, you might want to take
a look at Emacs :-)

CTags is a pain, since you have to reindex your files periodically and it
doesn't work well for other people's libraries. In IntelliJ IDEA it simply
works, you can just click on a class / function definition and if it doesn't
have the sources available for that JAR (say it's a library you depend on), it
downloads those sources automatically and takes you to the definition. For
Emacs it works if you have the right plugin installed - works for Clojure and
for Scala / Java for example (though for Scala / Java, we are talking about an
Eclipse-based engine running in the background :))

I do get the mentality of Vim users, I've been there and I even use Vim
sometimes, but depending on the problems you're working on and the platform
you're using, I lean towards the IDE approach nowadays. And Emacs is like a
general purpose and non-bloated IDE.

~~~
tuhdo
All those ports are incomplete and simple. You cannot use those to publish to
HTML, PDF, Latex and TexInfo. You cannot do literate programming in those
ports as well. Those are just shallow copies.

You should look at my guides if you want an IDE-like experience:
[http://tuhdo.github.io/](http://tuhdo.github.io/)

I find writing code in C/C++ with Emacs much faster than typical IDE:
[http://tuhdo.github.io/c-ide.html](http://tuhdo.github.io/c-ide.html)

For writing Lisp code, maybe except the commercial IDEs, none other tool
matches.

------
jaequery
I actually like the emacs key bindings.

~~~
ch49
I like the emacs key bindings too, but many times I find myself reading the
code with one hand used as a stand for my head. Vim's ease of movement across
text is what I wish at such times. Of course evil mode come to rescue then,
but I understand how so many people come to appreciate Vim's style so much
over time. I am finding myself on the same path.

------
EpicDavi
I read the title as "Toward a Vim: like Emacs"; was confused when the article
was talking about making Emacs like Vim instead of vice versa :/

------
yarrel
If I want a modal editor, Vim is there. I don't want a modal editor.

Breaking Emacs to make it more like Vi is cargo culting.

~~~
MichaelDickens
What if you want an editor with a powerful customization language,
sophisticated notetaking (org-mode), directory management (dired), as well as
modal editing?

~~~
tomsthumb
use evil or viper?

~~~
Ar-Curunir
And that's what the link is about, isn't it?

------
andyl
I'm watching NeoVim - they seem to be making solid progress and hope it will
give us a scriptable/embeddable vim. Would be great to have 1st-class
scripting support for Python or Ruby.

~~~
bronson
Last I saw they were writing a VimL->Lua transcoder. I think they'll allow
scripting in any language, but Lua will be the core language and have the best
support.

I donated to NeoVim few months ago and I'll donate again. Really wishing them
success.

------
carsongross
alt-x viper-mode

You're welcome.

~~~
pmoriarty
viper-mode is pretty outdated and broken in many ways. You should try evil-
mode.[1]

[1] - [http://www.emacswiki.org/Evil](http://www.emacswiki.org/Evil)

~~~
swartkrans
I also encourage people to use evil-leader with evil mode and check out other
evil plugins, like the * to select all instances of the word under a cursor.
Evil is very good, in some ways even better than vim, for example the live
updating search and replace is pretty awesome.

~~~
pmoriarty
It's also programmed in a Lisp dialect by default, which is even more awesome.

------
argherna
What I don't get when vim|emacs user wants emacs|vim to act like vim|emacs.
Why try to make one act like the other? Square peg, round hole.

~~~
evmar
I wrote a post about the reasons why I switched (~10 years of vi, now ~5 years
of emacs) here: [http://evan-tech.livejournal.com/261214.html](http://evan-
tech.livejournal.com/261214.html)

I also use evil-mode.

