Hacker News new | ask | show | jobs
by flowerlad 1924 days ago
One good reason is programmability. You can write lisp scripts to automate some routine editing.

For me the main reason I prefer emacs is the key bindings are better.

Another reason that emacs (the real thing) is available everywhere. You can install it on Linux, Mac and Windows. And you can run it in console mode (terminal) as well as GUI (even on Windows).

2 comments

For me the main reason I prefer emacs is the key bindings are better.

Genuine question, why do you think emacs key bindings are better?

Take for example, incremental search. Emacs has it by default. Vi being older didn't have it, but vim has it. It has to be turned on. Then it doesn't work as well as emacs. In emacs you can type to search then ctrl+s to move to next match then continue to type to edit the search string, and so on. This is just one example. Replace has advantages in emacs when it comes to case matching. And it goes on and on.
> It has to be turned on.

"set incsearch" is all it takes to get incremental search. Are you trying to argue that Emacs defaults are so good that you never need to change it? I find it hard to believe you never have any "setq"s in your Emacs config.

> In emacs you can type to search then ctrl+s to move to next match then continue to type to edit the search string

In vim you can type to search then n to move to next match then /<ctrl-p> to continue to edit the search string. But seriously, a fuzzy searcher or :grep would be more useful for that sort of thing.

> Replace has advantages in emacs when it comes to case matching.

Case matching is a thing with Vim's regex too.

> And it goes on and on.

But all of the things mentioned so far are about basic editing capabilities that any decent editor would support one way another.

Incremental search needs to be enabled, yes, but it’s just one line in your .vimrc.

What do you mean by “type to search”? Sounds like you’re omitting the “start search” key combo.

Your example in Vim:

* / to start a forward search

* type in the word and hit enter

* n/N for next/previous match

To modify the search:

* q/ opens your search history with the cursor at the last searched string

* modify the search string using standard Vim keys

* hit enter to search

> type in the word and hit enter

That's the problem. When you hit enter you have left incremental search. In emacs you can refine the search string without leaving. Ctrl+s and Ctrl+r goes prev/next and you can simultaneously refine the search string (by typing any other char) without leaving incremental search. Given how important search is (for a programmer) this alone is worth the price of entry. But there are many more things.

Thank you for that note on q/ ... I knew about q: for command history, and was wondering if there was an equivalent for search history.
That depends on what the meaning of "everywhere" is.