haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
221 stars 75 forks source link

Feature request: allow redefining commands #87

Closed boris-stepanov closed 5 years ago

boris-stepanov commented 6 years ago

Inspired by #14 . It would be great, if we could rebind Up and Down keys for incremental search. The proposition is to implement simple functions:

parseCommandKeyI :: (Monad m) => String -> Maybe (Command m InsertMode (Maybe String))
parseCommandKeyC :: (Monad m) => String -> Maybe (Command m CommandMode (Maybe String))

with available inputs like "history-incremental-search-backwards" and others. After that, we can replace viKeyCommands and emacsCommands with choiceCmd [bindCmd, viKeyCommands] and choiceCmd [bindCmd, emacsCommands] in getInputCmdLine. If you approve this idea, I'll prepare the commit.

boris-stepanov commented 5 years ago

Cool, thanks!