2

Given the following (cursor at |), how can I delete the text , int b?

foo(int a|, int b);

I was hoping to find a motion similar to how "inner" works (eg d i b), but which only captures the right-hand side from the current position.

d f ) also captures the found character, and I wanted to use this with all the usual motions.

Update: d t ) does what I want in this case, but only works on the current line, so I would still like to know if there is a general motion to go the end of what can be done with the inside motion.

  • 1
    dt) can work across the current line after customizing evil-cross-lines. – wasamasa Dec 21 '17 at 17:02
2

d ] ) should do what you're looking for evil-next-close-paren

  • I guess this is as good as it gets, but it doesn't work with d ] } for example. – altschuler Dec 21 '17 at 13:33
  • @altschuler yeah, that appears to be missing. You can do d i } but that removes everything between the curly braces. – Anntoin Wilkinson Dec 21 '17 at 14:43
0

The answer can also in part depend on the major mode: in modes using SMIE for their indentation needs (e.g. Octave, SML, Prolog, Ruby, CSS), there's a good chance that kill-sexp (by default bound to C-M-k, no idea what that translates into for Evil) would do the trick (and in a case like (int a|, int b, int c) it would also kill , int b).

  • kill-sexp does something slightly different, it doesn't work with nested parens, so eg foo(1|, bar(2)) deletes only , bar, where d ] ) deletes , bar(2). – altschuler Dec 21 '17 at 13:35
  • 1
    @altschuler: You're mistaken: in SMIE-based modes it works differently. But yes, in c-mode it works the way you describe (and actually even in sm-c-mode, which is based on SMIE, it also behaves the way you describe, since I had to disable that part of SMIE there because I had to use too many hacks which make it work OK for indentation but not for navigation). – Stefan Dec 21 '17 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.