martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.2k stars 258 forks source link

Mapping in menu mode #966

Closed adigitoleo closed 2 years ago

adigitoleo commented 2 years ago

Hi! Nice editor, I like the simple design.

I just have a question about exiting from menus. I like to map <M-;> to escape pretty much everywhere (coming from vim/neovim) because it's an easy combo to hit and doesn't usually conflict with anything (at least in my experience). But, in vis it seems that it's not being mapped when I'm in a menu (file picker, completion). And yes, for insert mode I mapped it to do escape twice, so I can also use it to exit the command line.

What's weird is that if I actually hit escape twice (or one <C-c>) from one of these menus, it works! I'm just curious if there is some special mode that I can use for the mappings. Or is there some other way of doing this?

If it helps, the same kind of "mode" seems to be active when I yank to wl-clipboard (using the + register) and I have to do <C-c> to get back to normal mode. If I start typing it just puts characters after the status line.

ghost commented 2 years ago

@adigitoleo the menus are handled by an external command, vis-menu(1), not vis. <C-c> and double escape worked for you because they are hardcoded, but I don't think vis-menu is configurable. If you can be bothered to compile vis-menu yourself, you can probably do the <M-;> thing in code.

jpaulogg commented 2 years ago

An alternative is to swap the CapsLock and Control keys. Whith this, pressing <C-c> is much easier.

adigitoleo commented 2 years ago

I see, thanks for the suggestions. I might just try to swap ctrl<->capslock for now, I'm already doing something similar for left alt<->super.