Hacker News new | past | comments | ask | show | jobs | submit login

Looks like I've got a choice to make (all on NixOS):

+ Stick with NeoVim and hope one of the Intero ports to that editor takes off (as I understand it there are a couple right now)

+ Switch to Emacs+Evil+Intero. I've never used Emacs before (even with Evil) so it would be a little work.

If someone more up-to-date on the situation has advice that would be awesome:)




I'm a emacs convert from vim (big reason is because module support is just leagues ahead of vim, Vundle, Pathogen, or anything else don't come close to emacs package management). A huge reason why I stuck with it is because evil. evil is very mature and is incredibly close to vim, some say it's a better vim than vim.

I tried a lot of "vi modes" in several IDEs but none of them cut it, you can map anything to evil and you can, of course, map commands to different states. Something I found very usefil is that you can even set states for different buffers, for example, for magit buffers (another amazing emacs module and a very good reason to use emacs) I default those to "insert" mode.

I haven't used Intero myself, but I've yet to find any kind of conflict between evil or any other module.


Evil seems to get some things wrong or weird. If I use the mouse, then using . to repeat last edit doesn't work. I've also had issues using macros sometime.

It also seems to have severe performance issues. Maybe it's Emacs, or rust-mode. But, say, running a macro 1000 times on a 10K line file is far slower than using vim.

But overall it's pretty great. I have the feeling it's easier to configure, once I get familiar with Emacs/elisp.


For what it's worth, I've had trouble with macros as well. Sometimes they run at a glacial pace. Very strange.


I tried to use Spacemacs but in vim I have hjkl mapped to jkl;. I simply could not find a way to do this in Spacemacs. All the solutions suggested did not apply to every mode and there was always some mode where I had to revert to hjkl. Is there any solution for this problem?


I use spacemacs and want to play with the vim part more, but I type dvorak, so I wanted to do a similar remapping and remap hjkl to htns so I would also be curious to hear if anyone has a good way to do that.


There appears to be a keyboard layout layer on develop[0] with support for dvorak.

Personally, I started looking into this when I started, but just got used to how hjkl are on dvorak (I still need the ability to be able to pick up with any random vim/vi I find on any random box, and don't find the utility in trading that).

[0] https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2...


Uh oh, this is pretty convincing=)


I don't know NixOS, but this blog post and lecture might help you give emacs a fair trial:

http://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-... https://www.youtube.com/watch?v=JWD1Fpdd4Pc

One of my vim-using coworkers found it. He, along with another colleague, have since found emacs compelling enough to use as their main text editor.


I spent a couple of days trying it out exclusively before giving up. Really nice all-in-all to keep me using it for so long, but eventually I ran into some big issues:

A) evil-mode doesn't support :next and :prev for navigating between filenames given on the commandline.

B) Emacs's mindset towards indentation fundamentally seems incompatible with Vi's.

  - Emacs
  RET - indent current line, then create new one
  TAB - indent current line

  - Vim
  RET - create new line and add indent to it
  TAB - insert some characters at point (nowhere else)
I tried to spend some time configuring it, but it's too hard to catch every language minor mode. Hitting tab sometimes moves forward two spaces, sometimes to the next mod-8 column and sometimes indents the current line, refusing to do anything else if it's already correct to Emacs's puny mind. It doesn't look like evil-mode is able to patch all the places this mindset leaks through.

A particularly egregious example is in the lisp minor-mode. Try this on a vanilla Emacs install without any startup files (I used v24.5.1 on OS X):

1. $ emacs x.lisp

2. Type in '; abc'. That's a lisp comment with a single comment leader semi-colon.

3. Hit enter.

The line gets right-justified to column 40 (5 tabs) before the cursor moves to the next line.

Apparently Emacs thinks all full-line comments in lisp should start with ';;'.

Needless to say, this behaves the same way even with evil-mode. I spent some time trying to track it down, but RET is just bound to vanilla newline, not indent-and-insert-newline or something like that. So I'll stop here.


> Apparently Emacs thinks all full-line comments in lisp should start with ';;'.

Not exactly. ;; aligns to the current indentation level of the code.

It's a usual Lisp indenting convention.

The Emacs Lisp manual recommends:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Co...

Common Lisp uses it also. See the ANSI CL spec.

2.4.4.2.1 Use of Single Semicolon

Comments that begin with a single semicolon are all aligned to the same column at the right (sometimes called the “comment column”). The text of such a comment generally applies only to the line on which it appears. Occasionally two or three contain a single sentence together; this is sometimes indicated by indenting all but the first with an additional space (after the semicolon).

2.4.4.2.2 Use of Double Semicolon

Comments that begin with a double semicolon are all aligned to the same level of indentation as a form would be at that same position in the code. The text of such a comment usually describes the state of the program at the point where the comment occurs, the code which follows the comment, or both.

2.4.4.2.3 Use of Triple Semicolon

Comments that begin with a triple semicolon are all aligned to the left margin. Usually they are used prior to a definition or set of definitions, rather than within a definition.

2.4.4.2.4 Use of Quadruple Semicolon

Comments that begin with a quadruple semicolon are all aligned to the left margin, and generally contain only a short piece of text that serve as a title for the code which follows, and might be used in the header or footer of a program that prepares code for presentation as a hardcopy document.


Wow, I can't believe I didn't know this after all this while hacking lisp. Many thanks.


Unfortunately those instructions failed out of the gate at this command in .emacs:

  (require 'package)
The error I get is:

  File error: "Cannot open load file", "package".
I installed emacs on OS X using:

  $ brew install emacs
But it looks like version 24.5 on OS X El Capitan doesn't come with something called 'package.el'. Oh well, back to Vim..


Are you sure that you launched the correct emacs? (`M-x version RET` in Emacs to check) This is an extremely common error for people using the built-in version which, as of El Capitan, is still Emacs 22.1 (almost 10 years old).


Ack, you're right! I installed it, added a symlink to the head of my path, but forgot to open a new terminal so continued using the old hashed path.

Edit 10 minutes later: Ok, it's installed now. And I've set this up in my .zshrc:

  -alias vi=vim
  +alias vi=emacs
Let's see how this goes.


If you want a little more terminal magic here are my emacs related shortcuts:

  alias et='TERM=xterm-256color emacsclient -t'
  alias ec='emacsclient -c -a=emacs'
  alias ed='emacs --daemon'
  alias kill-emacs='emacsclient -e "(kill-emacs)"'
  alias e='TERM=xterm-256color f -e "emacsclient -c -a=emacs"'
The reason for these is that emacs is a little slow to start up (in comparison to vim at least). So you can set up a daemon running ( ed command above, for emacs daemon. I don't have ed on my system)

You can then open up a new frame (window) of emacs with the ec command, or a new terminal session of emacs with the et command.

My favourite is the e command, which makes use of fasd[0] to find any "frecent" file, tries to open it with emacsclient, but, if emacs daemon is not running will fall back to opening a new emacs (which with spacemacs will start a new daemon running). This way I can open files in completely different directories if need be.

[0] https://github.com/clvv/fasd


Thanks for those tips! Just to contribute back a factoid in case you weren't aware, I noticed that the manpage for emacsclient says this:

"If the value of [the alternate editor] is the empty string, run `emacs --daemon' to start Emacs in daemon mode, and try to connect to it."

So your aliases would continue to work if you replace -a=emacs with -a=''. And you'd only pay the startup cost the first time you run ec or e.


Thanks, this is encouraging.


I'd also be curious to know if there is any way to support vim plugins in evil mode.




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

Search: