shabble / irssi-scripts

Repo to store some personal irssi scripts
151 stars 24 forks source link

[SOLVED] vim-mode "jk" command mode sequence #28

Closed liamdiprose closed 6 years ago

liamdiprose commented 7 years ago

In vim-mode, you can escape to command mode with "jj", this is great, but some people (including myself) use multi-character sequences instead; "jk" for example.

In vim, you can bind "jk" to Esc with this command :inoremap jk <Esc>

Would be great to have this in vim-mode; I'll have a scratch around in the code, but I'm not with my Perl

lime45 commented 6 years ago

my sequence of choice is "kj", so I second this. Also, did you get anywhere looking around in the code? I'm not up on my Perl as well.

lime45 commented 6 years ago

This is an ugly hack, but if you want to use 'jk' you would make the following change on line ~2749

>             if (not defined $map->{map} or chr($key) eq $map->{map}) {
---
<             if (not defined $map->{map} or chr($key) eq 'k') {

and then you would do /set vim_mode_cmd_seq j

liamdiprose commented 6 years ago

Thanks for the hack - its far futher than where I got.

As our difference in preference shows, if this functionality was to be added to the repository, it would need to be configurable, for example, /set vim_mode_cmd_seq jk

I'm going to assume this is quite a bit more involved than this simple hack. Combined with being a mere script and the lack of attention, I'm going to close/resolve this issue and hope others find @lime45 's solution.