Skip to content

Add support for vi mode - #3

Merged
laughedelic merged 1 commit into
laughedelic:masterfrom
terlar:bugfix/work-with-vi-mode
May 17, 2016
Merged

Add support for vi mode#3
laughedelic merged 1 commit into
laughedelic:masterfrom
terlar:bugfix/work-with-vi-mode

Conversation

@terlar

@terlar terlar commented May 16, 2016

Copy link
Copy Markdown
Contributor

VI mode will be useless with the current bindings since they are bound
to normal mode, this adds the possibility to set which mode should be
used to enable the pisces bindings in vi mode. (-M insert).

@terlar

terlar commented May 16, 2016

Copy link
Copy Markdown
Contributor Author

The alternative would be to not rely on the user configuring this and instead look at $fish_bind_mode.

@laughedelic

Copy link
Copy Markdown
Owner

👍 As far as I understand $fish_bind_mode stores the current mode, so it's not what we want here.
I was going to do it using the $fish_key_bindings var. I think there's no need to expose a new var for that:

# in key_bindings and pass it to _pisces_bind_pair as an argument
set -l _pisces_bind_mode default
if [ "$fish_key_bindings" = "fish_vi_key_bindings" ]
    set _pisces_bind_mode insert
end

Could you do it this way?

@terlar

terlar commented May 17, 2016

Copy link
Copy Markdown
Contributor Author

@laughedelic I updated using this instead. Only thing I am not sure about is the position of the mode argument, I would prefer having it first, but that would break existing installations if they have copied the key_bindings. This new way fallbacks to default inside the _pisces_bind_mode in order to safeguard calling the function without mode also.

What do you think?

@laughedelic

Copy link
Copy Markdown
Owner

Looks good! I would also make mode the first argument, but I think it's not so important now, because I'm going to introduce some other breaking changes in #5 and leave this _pisces_bind_pair for backward compatibility: old settings (with pisces_pairs) will work using that function as before for those who have their own settings and if they want to upgrade, they can just reset that var to the new default.

So I would merge it as it is now, but it requires updating this branch to the current master first (with the changes from #4).

VI mode will be useless with the current bindings since they are bound
to normal mode, this adds the possibility to set which mode should be
used to enable the pisces bindings in vi mode. (`-M insert`).
@terlar

terlar commented May 17, 2016

Copy link
Copy Markdown
Contributor Author

Rebased towards new master, also switched around mode to be in the beginning.

@laughedelic

Copy link
Copy Markdown
Owner

Well done 👍

@laughedelic
laughedelic merged commit 863a34c into laughedelic:master May 17, 2016
@laughedelic

Copy link
Copy Markdown
Owner

@terlar one thing I forgot about is the uninstall script. It erases bindings and it should also take mode parameter. I'm fixing it.

@laughedelic

Copy link
Copy Markdown
Owner

Published v0.4.0. Thanks for your contribution @terlar 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants