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 Ctrl-[ as an escape key #763

Merged
merged 1 commit into from
Mar 4, 2024
Merged

feat: add Ctrl-[ as an escape key #763

merged 1 commit into from
Mar 4, 2024

Conversation

hankertrix
Copy link
Contributor

In Vim, Ctrl + [ is an alternative to using the key and behaves exactly the same way. This pull request adds that functionality to Yazi.

Also added ^ as a key to move to the beginning of the line, like in Vim. This is a little inaccurate as in Vim, the ^ key moves to the first non-whitespace character in a line, not to the beginning of the line, but I think for the use cases in Yazi, the ^ key being the same as the 0 key shouldn't be much of an issue.

@sxyazi
Copy link
Owner

sxyazi commented Mar 4, 2024

Thanks for your PR!

Ctrl + [ is not an alternative for the Esc in Vim. The reason it can be used as an Esc is that in the keyboard protocol, Ctrl+[ and Esc are considered the same key, which is a bug/coincidence in the keyboard protocol. Yazi uses an extended keyboard protocol, so it is capable of recognizing them as two separate keys in some new terminals. Also see helix-editor/helix#6551

However, if this could enhance user experience, I can accept adding it, but I'm sorry I can't accept ^ as it would be a bug since it is inconsistent with Vim's behavior.

@hankertrix
Copy link
Contributor Author

hankertrix commented Mar 4, 2024

I see. Quite a few Vim users' would find it easier to use Ctrl + [ instead of Esc, including me, so it'll improve the user experience to have it implemented by default.

Got it, I'll remove the ^ key binding.

I'm assuming that Ctrl + c as an alternative for Esc wouldn't be wanted as well since it behaves slightly differently from the Esc key in Vim?

@sxyazi
Copy link
Owner

sxyazi commented Mar 4, 2024

I will add Ctrl-c as a breaking change in Yazi v0.3, to replace Ctrl-q, as it is more conventional and closer to Ctrl.

Thank you for contributing to this feature, let's merge it now!

@sxyazi sxyazi changed the title feat: add Ctrl + [ as an escape key feat: add Ctrl-[ as an escape key Mar 4, 2024
@sxyazi sxyazi merged commit b7d9a0a into sxyazi:main Mar 4, 2024
5 checks passed
@hankertrix
Copy link
Contributor Author

I see, that’s great! Looking forward to that change.

Thanks for merging my pull request!

asim215 pushed a commit to asim215/yazi that referenced this pull request Mar 5, 2024
asim215 added a commit to asim215/yazi that referenced this pull request Mar 5, 2024
* ci: add cachix workflow (sxyazi#740)

* feat: add hovered as `$0` for shell and opener (sxyazi#738)

* feat: flavor (sxyazi#753)

* feat: add a new `[notify]` section to the `theme.toml` to configure the `notify` component's style (sxyazi#749)

* feat: switch to inline images protocol for VSCode, Tabby, and Hyper

* feat: add `prepend_rules` and `append_rules` for `[open]` in `yazi.toml` (sxyazi#754)

* feat: support `YAZI_FILE_ONE` environment variable for `file(1)` path (sxyazi#752)

* feat: allow both '/' and '\' in folder creation (sxyazi#751)

* perf: apply `add_many()`/`remove_many()` to the visual mode items for selection conflict detecting (sxyazi#758)

* feat: support `%0` as the hovered file for Windows (sxyazi#761)

* feat: `ya.input()` plugin API (sxyazi#762)

* fix: remove redundant check to allow operations on the `shell` command with an empty file list

* feat: add musl linux build targets (sxyazi#759)

* fix: nested conflict detection exception when performing cross-level searches (sxyazi#769)

* refactor: add new `run` property (sxyazi#773)

* feat: add `Ctrl-[` as an escape key (sxyazi#763)

* feat: add `parse` method to `Line` element

* feat: `ya.notify()` plugin API (sxyazi#780)

---------

Co-authored-by: musjj <72612857+musjj@users.noreply.github.com>
Co-authored-by: rrveex <91850165+rrveex@users.noreply.github.com>
Co-authored-by: sxyazi <sxyazi@gmail.com>
Co-authored-by: little camel <54983536+evpeople@users.noreply.github.com>
Co-authored-by: Filipe Paniguel <paniguel.lpnh@gmail.com>
Co-authored-by: Nguyễn Đức Toàn <33489972+ndtoan96@users.noreply.github.com>
Co-authored-by: Konrad Baran <65494005+uznog@users.noreply.github.com>
Co-authored-by: hankertrix <91734413+hankertrix@users.noreply.github.com>
@sxyazi sxyazi mentioned this pull request Mar 23, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 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