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

Use a function to bind keys #5

Merged
merged 1 commit into from
Nov 9, 2020
Merged

Use a function to bind keys #5

merged 1 commit into from
Nov 9, 2020

Conversation

bitkeen
Copy link
Contributor

@bitkeen bitkeen commented Nov 8, 2020

With local m executed outside of a function it prints m=visual on zsh startup, also doesn't seem like local works as intended outside a function - after shell startup I can access the m value which was set in vi-increment.zsh

vi-increment.zsh Outdated
Comment on lines 16 to 24
bind_keys () {
local m
for m in vicmd visual; do
bindkey -M "$m" '^a' vi-increment
bindkey -M "$m" '^x' vi-decrement
done
}

bind_keys
Copy link
Member

Choose a reason for hiding this comment

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

Use an anyonymous function instead:

Suggested change
bind_keys () {
local m
for m in vicmd visual; do
bindkey -M "$m" '^a' vi-increment
bindkey -M "$m" '^x' vi-decrement
done
}
bind_keys
() {
local m
for m in vicmd visual; do
bindkey -M "$m" '^a' vi-increment
bindkey -M "$m" '^x' vi-decrement
done
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@xPMo
Copy link
Member

xPMo commented Nov 9, 2020

Thank you!

@xPMo xPMo merged commit 1924b04 into zsh-vi-more:master Nov 9, 2020
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

Successfully merging this pull request may close these issues.

2 participants