This is a read-only archive!

searchpairpos

How did I live this long without knowing about searchpairpos() in Vim? I hate when I write a clumsy, slow reimplementation of something that already exists as a standard function.

The only bad thing about Vim and Emacs both is that the feature list is about a mile and a half long (and that's a bad thing only in the sense of being an overwhelming amount of good things).

I have read almost the entire Vim manual at this point but there are corners that remain unexplored, and sometimes they contain treasure. One thing I love doing is answering Vim questions on Stack Overflow because most of the time I don't know the answer right off the bat, and so looking it up or figuring it out teaches me something new.

Emacs is another story... Emacs remains a mystery to me in many ways, in spite of having used it for about a year now. I very much plan to read the whole Emacs manual. I've already read parts of it but I seem to have barely made a dent. There are things I know should be simple to do or that there are already built-in options for, but I don't know how to do them.

  • How do I kill a word and also kill the whitespace immediately after it so it yanks properly later?
  • When I kill-whole-line and paste that line elesewhere, I lose a newline and screw up indenting. Sometimes it works how I expect and sometimes it doesn't.
  • There are so many things I can do in Vim but can't in Emacs... marks, multiple registers, abbreviations, sensibly configured per-filetype indentation.

etc. etc. I know there are ways to do these things once I have time to just sit down and read the darned manual. And learn elisp's syntax and semantics (which can't be harder than learning Vim script). My ~/.vimrc is currently twice as long as my ~/.emacs, which says a lot.

On a related note, I'm in the process of putting my Vim and Emacs configs on github.

August 20, 2009 @ 7:39 AM PDT
Cateogory: Programming
Tags: Emacs, Vim

3 Comments

Leonel
Quoth Leonel on August 20, 2009 @ 9:47 PM PDT

Frist !

A) and B) set kill-whole-line to t. The different behaviors you're seeing are when point is at the beginning of line, which kills the whole line, or in the middle, which only kills until end of line.

C) copy to register: C-x r x abbrev expansion: M-/ marks: C-spc (I admit this one is hard to figure out, see pc-selection-mode)

As a general rule, you can go apropos (C-h a) to find a lot about functions and variables.

Regards, Leonel

Brian
Quoth Brian on August 21, 2009 @ 4:58 PM PDT

Thanks for the tips.

Trey Jackson
Quoth Trey Jackson on October 22, 2009 @ 3:38 AM PDT

So you answer questions for vi on stackoverflow.com, but you've only asked ... 4 Emacs questions? Just like you, I enjoy the challenge of answering questions on stackoverflow (looks like I've missed yours though), and I'm sure we can work through your frustrations pretty quickly. Just post them.

RE: some of your frustrations

Emacs' undo is kind of the way it is. I happen to like it (and hate the rest of the world's undos...)

The backspace causing new undo events, hmmm... 'self-insert does it already..., seems pretty doable.

Regarding abbreviations, see 'dabbrev, though I personally prefer hippie-expand. Though if you're looking for more template like behavior, you can always try yasnippet (nicest template package for Emacs IMO).

See ya on SO.