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

> Not good for editing, not good for copying or moving code, not good for navigating, not good for working with brackets or parenthesis

Hmm. OK, I wonder why. For me M-h selects a a paragraph. Repeated M-h selects further. M-w copies it. S-M-{ or S-M-} to jump by paras.

M-s . for symbol lookup. In that family you can do highlight regexp or line.

M-s o - get an overview of every line that matches what you want ('occurs')

etc. etc.

Macros, registers (using these to store large chunks of text, basically class templates). etc.




Thank you. I would love nothing more that to be proven wrong! Some common things that I do in VIM:

  * Copy or cut everything between these quotes / parenthesis / brackets.
  * Delete up until the next X character. Now delete up until the next X character again.
  * Cut these rows then paste them over there.
  * Change all instances of "foo" to "bar".
  * Show all lines with (or without) "foo".
  * Reformat a line like so, now do it to the 351 line following it.
  * Reindent this section of text.
  * Go to the beginning of this if() / method / loop.
  * Go the the file where this Python / PHP class is defined.
  * In markdown files, open this hyperlink
  * Search for the first occurrence of this token in this method.
  * Search for the next occurrence of this word (actually learned to do this today, for the most part)
These were just example off the top of my head in a few seconds, none of which had an easy answer in Emacs. Sure, I could spend ten minutes each to look for how to do each one. I probably did that during the Clinton administration with VIM, before one could just google their problems away. But in VIM, each one has an easy answer and most are actually built right into VIM with no customization necessary. In Emacs, I could implement that stuff but then I'll be implementing everything else I need.

So I use Evil!


Hmm. This is tricky and I'm not sure I completely get your requirements, but let me try. Other emacs dudes will need to step in. In the following no customisation needed as I don't use elisp.

  Copy or cut everything between these quotes / parenthesis / brackets.
Don't know. Never needed to. Trivial with a macro

  Delete up until the next X character. Now delete up until the next X character again.
Never used it but https://www.gnu.org/software/emacs/manual/html_node/emacs/Ot... M-z char - Kill through the next occurrence of char (zap-to-char).

  Cut these rows then paste them over there.
Well, select rows, kill, move to new place, yank. Not sure what else you want.

  Change all instances of "foo" to "bar".
M-S-% - query replace (and variations such as regexp)

  Show all lines with (or without) "foo".
Erm can only do with, but as in original post, M-s o (occurs)

  Reformat a line like so, now do it to the 351 line following it.
Not sure your requirements but command align-regexp works for me. Don't know what else you want.

  Reindent this section of text.
Depends on mode, but select text then TAB key.

  Go to the beginning of this if() / method / loop.
Don't know. Perhaps Search reverse for { char?

  Go the the file where this Python / PHP class is defined.
Mode specific. I'd be pretty sure that kind of functionality doesn't come built into vim. I use Omnisharp which does similar but it's an external package.

  In markdown files, open this hyperlink
mode specific. Presumably also in Vim?

  Search for the first occurrence of this token in this method.
Just search forward. That may not be quite what you want, maybe.

  Search for the next occurrence of this word (actually learned to do this today, for the most part)
M-s . when on symbol. Subsequently C-s search forward, C-r searches reverse (backward).

But I'm not trying to change your mind, use what suits best.

Edit: M-S h is highlight-regexp which highlights all matches in the buffer in colour (does depend one some mode stuff, but works in most modes).


  > But I'm not trying to change your mind, use what suits best.
Quite the opposite, I very much appreciate the engagement. You have likely saved me a few hours as I do intend to learn how to use Emacs properly.

Some of the things I see that I was not clear about, but I do not need to belabour and now I've got some great headstarts on the rest. You are correct, some of the functionality mentioned are in fact provided in VIM via plugins.

Thank you.


That's a lovely reply! The problem with emacs is there is just too much, and the chaff obscures the wheat. It frustrates me too, as there's some really good stuff there that I don't know about.

Suggest grabbing the emacs book https://www.oreilly.com/library/view/learning-gnu-emacs/0596... and/or the emacs manual from https://www.gnu.org/software/emacs/manual/ (free pdf) and go through them. They will repay the time!

Good luck and remember any pro emacs user will trip themselves up to help newbies learn!


Thanks for the book suggestions. Emacs is a way of life!

  > Good luck and remember any pro emacs user will trip
  > themselves up to help newbies learn!
I've noticed this. The Emacs community is one of the most welcoming tech communities that I've seen, and have helped accelerate my learning curve tremendously. Thank you.


A couple more - look at C-x 3 (split screen vertically) the issue command follow-mode. You can have several vertical views next to each other, all shiowiing a contiguous view of your code - very nice! a bit flaky sometimes but incredibly useful.

C-x 2 - split window horizontally - bloody useful.

Get used to macros if you haven't already.

Issue part of a command then ? for help eg. M-s ? gives you a family of stuff inc the aforementioned occurs command.

Look up registers. Dead handy. Also look at (IIRC) Bookmark+ (?) which allows you to save your desktop config then reloads it next time you start up.


Thank you! Almost everything that you mention look very useful for my use cases. In fact, my monitor sits in portrait mode, so I do use horizontal splits in other programs as well.




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

Search: