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

feat: add cursor option to the shell command #1422

Merged
merged 3 commits into from
Aug 9, 2024
Merged

Conversation

HE7086
Copy link
Contributor

@HE7086 HE7086 commented Aug 6, 2024

Add a cursor option to shell command, similar to rename.
This allows user to define keymaps with cursor set to generic place, so that they don't have to manually move the cursor every time. When the option is unspecified the behavior is same as before (at the end).
Some examples:

[manager]
prepend_keymap = [
  # cursor at end, same as before
  { on = [ ":" ], run = 'shell --block --interactive "vim $@"' },
  # cursor at start, user can input command directly, e.g. vim
  { on = [ ":" ], run = 'shell --block --interactive --cursor=start "$@"' },
  # cursor after 7th char (command), user can input flags directly.
  { on = [ ":" ], run = 'shell --block --interactive --cursor=7 "command $@"' },
]

--cursor=start is equivalent to --cursor=0. I added it here because it is supported by rename already. There could be some extra variants like after_first, before_last if necessary. --cursor=<usize> is sufficient for most cases.

@sxyazi sxyazi changed the title feat: add cursor option to shell command feat: add cursor option to the shell command Aug 9, 2024
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sxyazi sxyazi merged commit 3bb867c into sxyazi:main Aug 9, 2024
6 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants