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

some ctrl-* keybindings only work with insert mode #195

Open
2 of 3 tasks
diminutivesloop opened this issue Nov 10, 2022 · 12 comments
Open
2 of 3 tasks

some ctrl-* keybindings only work with insert mode #195

diminutivesloop opened this issue Nov 10, 2022 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@diminutivesloop
Copy link

General information

  • Terminal program: Terminal 2.12.7
  • Operating system: Mac OS 12.6.1
  • ZSH framework: oh-my-zsh
  • ZSH version: 5.8.1
  • ZVM version: 0.9.0

Basic examination

  • I have read through the README page
  • I have the latest version of zsh-vi-mode
  • I have tested with another terminal program

Problem description

Some ctrl-* keybindings only work in insert mode. Specifically I'm using the per-directory-history zsh plugin and I cannot use ctrl-g to switch between global and directory history when in normal mode even though other keyboard commands such as ctrl-c work in both modes. I'm initializing per-directory-history via zvm_after_init and I tried disabling lazy loading via ZVM_LAZY_KEYBINDINGS=false but this didn't fix the issue.

Reproduction steps

N/A

Expected behavior

Any ctrl-* keybindings that are not assigned to this plugin should work as expected in all input modes.

@jeffreytse jeffreytse added the bug Something isn't working label Jul 11, 2023
@jeffreytse jeffreytse self-assigned this Jul 11, 2023
@cohml
Copy link

cohml commented Jul 21, 2023

Big bump for this one please!!!

@jeffreytse
Copy link
Owner

jeffreytse commented Jul 21, 2023

Hi @diminutivesloop

Thanks for your reporting, I want to confirm the bellowing items with you firstly:

  1. Is it this plugin?
  2. Are you sure, without enabling zsh-vi-mode, this plugin can work under vi normal mode?

Thanks & Regards

@cohml
Copy link

cohml commented Jul 21, 2023

I'm not @diminutivesloop, but I can be another data point.

I use this plugin, which is the same as the one you linked, except that I install it via Oh-My-Zsh.

With per-directory-history enabled, here's what I've observed:

  • When I enable zsh-vi-mode, CTRL-G stops working.
  • When I disable zsh-vi-mode but enable bindkey -v, CTRL-G stops working.
  • When I disable zsh-vi-mode and disable bindkey -v, CTRL-G works.

@jeffreytse
Copy link
Owner

jeffreytse commented Jul 21, 2023

@cohml Have you tried to source the plugin as below?

zvm_after_init() {
  source <your_plugin_location>/per-directory-history.plugin.zsh
}

@cohml
Copy link

cohml commented Jul 21, 2023

Hey that fixes it for me!

I know your README already covers this a bit. For some reason it just hadn't occurred to me that zvm_after_init could also work with zsh plugins too.

But in retrospect that makes perfect sense. The README even mentioned zsh-autocomplete specifically... I think your bases are all already covered here 😅

Anyway, sorry for the confusion and thanks for the help! I vote to close this issue.

@jeffreytse
Copy link
Owner

jeffreytse commented Jul 21, 2023

@cohml You're welcome, and hope this plugin can accelerate your daily work. And also welcome to star this project for further updates in the future. : )

@cohml
Copy link

cohml commented Jul 21, 2023

I'm still not @diminutivesloop lol, so I'd wait for him to respond before closing.

But I will star for sure. This project is great and you are a very responsive dev. Thanks again!

@jeffreytse
Copy link
Owner

@cohml You're welcome, welcome to submit your issues whenever you meet. : )

@diminutivesloop
Copy link
Author

Hi @diminutivesloop

Thanks for your reporting, I want to confirm the bellowing items with you firstly:

1. Is it [this plugin](https://github.com/jimhester/per-directory-history)?

2. Are you sure, without enabling zsh-vi-mode, this plugin can work under vi normal mode?

Thanks & Regards

Yes that's the plugin I'm referring to. And I did just test with the regular vi-mode plugin and the issue manifests in that case as well.

@cohml
Copy link

cohml commented Jul 21, 2023

@diminutivesloop Try this. Just add that to your .zshrc, adjusting the path as necessary ofc.

I had the same issue as you, and this solution seems to have fixed it.

@jeffreytse
Copy link
Owner

@diminutivesloop Could you try as @cohml said, and see if your issue could be settled down?

@diminutivesloop
Copy link
Author

diminutivesloop commented Aug 10, 2023

@jeffreytse That appears to work. I tried the same thing before with no success, but that may have been before I switched to installing the HEAD version of this plugin to address another issue.

Update: so I was able to fix the keybinding issue by initializing per-directory-history from zvm_after_init() however I noticed that the shortcut wasn't working exactly as expected. Instead of starting in local mode and then switching to global on ctrl+g it would start in global mode and I had to trigger the keyboard shortcut twice to get to local mode. Eventually I was able to fix both issues by including per-directory-history in my ohmyzsh plugins array in addition to sourcing it in zvm_after_init().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants