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

Does not work with k in vi mode #106

Open
vegerot opened this issue Dec 7, 2019 · 9 comments
Open

Does not work with k in vi mode #106

vegerot opened this issue Dec 7, 2019 · 9 comments

Comments

@vegerot
Copy link

vegerot commented Dec 7, 2019

The plugin works fine with arrow keys. However, in normal mode pressing j and k just scrolls through history as if I didn't have the plugin.

Some configuration information if it helps:

plugins=(vi-mode, history-substring-search)
setopt vi
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd "�" edit-command-line

@vegerot vegerot changed the title Does not with k in vi mode Does not work with k in vi mode Dec 7, 2019
@alichtman
Copy link

Try this:

# Bind j and k for in vim mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down

@vegerot
Copy link
Author

vegerot commented May 5, 2020

@alichtman awesome! Thank you

@alichtman
Copy link

No problem! Safe to close this issue?

@vegerot
Copy link
Author

vegerot commented May 6, 2020

Of course!

@vegerot vegerot closed this as completed May 6, 2020
@vegerot
Copy link
Author

vegerot commented May 8, 2020

@alichtman thanks so much for the suggestion. It worked great (for a while), but I've now found a slight flaw in it. If I'm editing multiple line commands in zsh, trying to navigate up/down lines in normal mode cycles through my history.

The behavior that I'm looking for would be the same behavior I'd get with the arrow keys. Where if I try navigating past the top or bottom line in my command it would cycle through my history, but otherwise would navigate in line mode.

@vegerot vegerot reopened this May 8, 2020
@alichtman
Copy link

You could try mapping J and K to history scrolling and leaving j and k mapped normally.

@vegerot
Copy link
Author

vegerot commented May 9, 2020

lol but what if I want to merge lines?

@alichtman
Copy link

That’s a good point. I don’t know how to fix that behavior tbh, just throwing out some possible solutions.

@vegerot
Copy link
Author

vegerot commented May 20, 2020

Thank you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants