Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add key bindings for evil-backward-arg and evil-forward-arg #1167

Closed
oneeman opened this issue Apr 15, 2015 · 3 comments
Closed

Add key bindings for evil-backward-arg and evil-forward-arg #1167

oneeman opened this issue Apr 15, 2015 · 3 comments
Labels
- Forum - Evil Key Bindings Ready for work stale marked as a stale issue/pr (usually by a bot)

Comments

@oneeman
Copy link
Contributor

oneeman commented Apr 15, 2015

I noticed that evil-args is configured to bind a as the argument text object (

(defun spacemacs/init-evil-args ()
(use-package evil-args
:init
(progn
;; bind evil-args text objects
(define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
(define-key evil-outer-text-objects-map "a" 'evil-outer-arg))))
), but there don't seem to be bindings for the motions it allows. This is a very useful thing to have for navigating in argument lists, and would make sense since evil-args is one of the packages in the spacemacs core rather than its own layer. But of course possible key bindings don't grow on trees (and H and L, suggested at https://github.com/wcsmith/evil-args are already taken with standard bindings), so I thought I'd open up an issue to see if this is something that might be doable and worth doing.

And there is vim-jump-args, which I could also see being useful (though I haven't used it myself, being new to both vim and emacs).

Ping @danielwuz and @syl20bnr , who were behind the PR to add evil-args.

@danielwuz
Copy link
Contributor

thanks for bring this up.

In my opinion, evil-forward-arg and evil-backward-arg are similar to the motion of evil-forward-WORD-begin and evil-backward-begin, respectively. This is because usually a good code style has spaces around arguments, e.g.

function_name(arg1, arg2, arg3, arg4)

and W and E work in the same way as evil-args brings to us.

And if there's no spaces around arguments, yes, evil-args would still work fine. But it's probably a better idea to fix the code to make it prettier in this case.

I think the motion evil-jump-out-args might be much more useful here. Often times I found myself was in the middle of some arguments and need a quick way to jump to function name, having a key binding to evil-jump-out-args might be handy. @syl20bnr what do you think? what's the best key for evil-jump-out-args?

@oneeman
Copy link
Contributor Author

oneeman commented Apr 15, 2015

Thanks for the suggestion. That works well in most cases, but doesn't work as well when a single argument contains spaces itself, e.g. my_func(a + b, c, d) and so on. So if they could be accommodated they'd certainly be appreciated. Of course, if not it's no big deal, since anyone who needs them can add their own binding. Just a thought.

And now that you mention it, evil-jump-out-args could also be useful for things like
foo(a, [1, 2, 3], x, y).

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Evil Key Bindings Ready for work stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

5 participants