haskeline-0.2.1: A command-line interface for user input, written in Haskell.

System.Console.Haskeline.Prefs

Description

Prefs allow the user to customize the line-editing interface. They are read by default from ~/.haskeline; to override that behavior, use readPrefs and runInputTWithPrefs.

Each line of a .haskeline file defines one field of the Prefs datatype; field names are case-insensitive and unparseable lines are ignored. For example:

 editMode: Vi
 completionType: MenuCompletion
 maxhistorysize: Just 40

Synopsis

Documentation

data Prefs Source

Constructors

Prefs 

Fields

bellStyle :: !BellStyle
 
editMode :: !EditMode
 
maxHistorySize :: !(Maybe Int)
 
completionType :: !CompletionType
 
completionPaging :: !Bool

When listing completion alternatives, only display one screen of possibilities at a time.

completionPromptLimit :: !(Maybe Int)

If more than this number of completion possibilities are found, then ask before listing them.

listCompletionsImmediately :: !Bool

If False, completions with multiple possibilities will ring the bell and only display them if the user presses TAB again.

Instances

Read Prefs 
Show Prefs 
Monad m => MonadReader Prefs (InputT m) 

data EditMode Source

Constructors

Vi 
Emacs 

defaultPrefs :: PrefsSource

The default preferences which may be overwritten in the .haskeline file:

 defaultPrefs = Prefs {bellStyle = AudibleBell,
                      maxHistorySize = Nothing,
                      editMode = Emacs,
                      completionType = ListCompletion,
                      completionPaging = True,
                      completionPromptLimit = Just 100,
                      listCompletionsImmediately = True
                    }

mkSettor :: Read a => (a -> Prefs -> Prefs) -> String -> Prefs -> PrefsSource

readPrefs :: FilePath -> IO PrefsSource

Read Prefs from a given file. If there is an error reading the file, the defaultPrefs will be returned.