Emacs equivalent to VIM ci"?
Solution 1:
Off the top of my head, the closest command is M-z "
which deletes everything from point to the next occurance of the " character.
There is also C-M-k
, aka "kill balanced expression", which will delete a full parenthesized statement or double quoted string etc. based on the current modes definition of "balanced expression" and the character currently under point (ie. it only works if the cursor is on the opening '"' or '(' etc.).
Solution 2:
Similarly to Justin's suggestion C-M-SPACE gives you "mark-sexp" which will select to the balancing paren, quote, etc. and then you can C-w or whatever to make it go away. In case you want to SEE what you're about to delete before you delete it...
Solution 3:
Yes! The equivalent of VIMs ci" command in Emacs is... ci" :-)
http://www.emacswiki.org/emacs-de/Vimpulse
Solution 4:
Just stumbled upon this question; here is a custom solution that's worked for me:
(defun seek-backward-to-char (chr)
"Seek backwards to a character"
(interactive "cSeek back to char: ")
(while (not (= (char-after) chr))
(forward-char -1)))
(defun delete-between-pair (char)
"Delete in between the given pair"
(interactive "cDelete between char: ")
(seek-backward-to-char char)
(forward-char 1)
(zap-to-char 1 char)
(insert char)
(forward-char -1))
Then bind delete-between-pair to whatever key you like. For me, I have it bound on C-z i.
Solution 5:
I'm afraid I don't know about VIM's ci feature, but have you looked at Emacs regexp replace? I can't speak to the exact semantics or how easy it is to use in comparison, but it's what I would use for what I think you want.
- Emacs manual on regexp replace
- Notes on Emacs regexp matching
- Obligatory cartoon