Ticket #99 (assigned enhancement)

Opened 5 years ago

Last modified 5 years ago

Define key bindings in terms of commands rather than other keys

Reported by: korpios Owned by: judah
Priority: major Milestone:
Version: Keywords:
Cc: korpios@…

Description (last modified by korpios) (diff)

Right now, haskeline defines key bindings in terms of other keys; this is quite confusing compared to other key binding system which define bindings in terms of particular commands.

For instance, if a user wanted meta-j to go back one character, haskeline expects you to define it in terms of ctrl-b rather than a command like backward-char. Furthermore, the current system actually changes the meaning of your bindings depending on which binding style you are using; ctrl-r may suddenly change meaning from "search backwards" to "redo" if you switch from emacs to vi style.

It would be much easier to define a non-trivial ~/.haskeline file like so:

bind: ctrl-r backward-char
bind: ctrl-s forward-char
bind: ctrl-b backward-search
bind: ctrl-f forward-search

...than the current case:

bind: ctrl-r ctrl-b
bind: ctrl-s ctrl-f
bind: ctrl-b ctrl-r
bind: ctrl-f ctrl-s

It is immediately clear what the former is doing, and not at all clear what the latter is. I certainly wouldn't want to puzzle out a ~/.haskeline file with several dozen bindings as the system currently stands.

Change History

Changed 5 years ago by korpios

  • cc korpios@… added

Changed 5 years ago by korpios

  • description modified (diff)

(fix typo in description)

Changed 5 years ago by judah

  • owner set to judah
  • status changed from new to assigned

Thanks for the report! I agree that this feature is important to have; to do it properly as you've described will require some restructuring of the internal APIs, though. See also #90.

Note: See TracTickets for help on using tickets.