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

Add vi mode indicator #38

Open shanemikel opened 8 years ago

shanemikel commented 8 years ago

Readline has an option: show-mode-in-prompt that works with editing-mode vi to give an indicator of the vi editing mode, in the form of the leftmost prompt character showing a '+' in insert mode, and ':' in normal mode, (it removes the character all-together when doing a search with /, I guess if it supports other command-mode commands, it would do the same thing)

It would be great if I could get this in my ghci.. That being said, just because readline does it this way, doesn't mean it makes more sense than having something customizable in the configuration of the prompt itself. Any thoughts?

judah commented 8 years ago

That sounds like a reasonable addition to the existing UserPreferences. I probably won't have time to implement it anytime soon, though. Let me know if you're interested in doing it an/or would like pointers around the codebase. (The printing of the prompt is controlled by System.Console.Haskeline.LineState.)

hgiesel commented 8 years ago

How (i.e. where) are entries from the .haskeline dotfile parsed inside Haskeline?

judah commented 8 years ago

They're parsed as part of System.Console.Haskeline.Prefs.readPrefs; the full list of prefs is defined here: http://hackage.haskell.org/package/haskeline-0.7.2.3/docs/src/System.Console.Haskeline.Prefs.html#settors

neonpixii commented 5 years ago

This would be a very useful feature. I'm very used to being able to see what mode fish shell is in and having that in GHCI would be helpful.

joshcho commented 3 years ago

Is there a way to change cursor shapes for different vi modes? I have that with zsh like so. For me, this was intuitive enough where you don't need any other indicator.

michalspano commented 11 months ago

Any updates on this?