Safe Haskell | None |
---|---|
Language | Haskell2010 |
A Config
can be provided to mkVty to customize the applications use of vty. A config file can
be used to customize vty for a user's system.
The Config
provided is mappend'd to Config
s loaded from
and getAppUserDataDirectory
/config$VTY_CONFIG_FILE
. The $VTY_CONFIG_FILE
takes precedence over the config
file or the
application provided Config
.
Each line of the input config is processed individually. Lines that fail to parse are ignored. Later entries take precedence over earlier.
For all directives:
string := "\"" chars+ "\""
Debug Directives
debugLog
Format:
"debugLog" string
The value of the environment variable VTY_DEBUG_LOG
is equivalent to a debugLog entry at the
end of the last config file.
Input Table Directives
map
Directive format:
"map" term string key modifier_list
where
key := KEsc | KChar Char | KBS ... (same as Key
)
modifier_list := "[" modifier+ "]"
modifier := MShift | MCtrl | MMeta | MAlt
term := "_" | string
EG: If the contents are
map _ "\ESC[B" KUp [] map _ "\ESC[1;3B" KDown [MAlt] map "xterm" "\ESC[D" KLeft []
Then the bytes "\ESC[B"
will result in the KUp event on all terminals. The bytes
"\ESC[1;3B"
will result in the event KDown with the MAlt modifier on all terminals.
The bytes "\ESC[D"
will result in the KLeft event when TERM
is xterm
.
If a debug log is requested then vty will output the current input table to the log in the above format.
EG: Set VTY_DEBUG_LOG. Run vty. Check debug log for incorrect mappings. Add corrected mappings to .vty/config
- type InputMap = [(Maybe String, String, Event)]
- data Config = Config {}
- singleEscPeriod :: Config -> Int
- type ConfigParser s a = ParsecT s () (Writer Config) a
- userConfig :: IO Config
- parseConfigFile :: FilePath -> IO Config
- runParseConfig :: Stream s (Writer Config) Char => String -> s -> Config
- configLanguage :: Stream s m Char => GenLanguageDef s u m
- configLexer :: Stream s m Char => GenTokenParser s u m
- mapDecl :: (Stream s (WriterT Config m) Char, Monad m) => ParsecT s u (WriterT Config m) ()
- parseKey :: Stream s m Char => ParsecT s u m Key
- parseModifiers :: Stream s m Char => ParsecT s u m [Modifier]
- parseModifier :: Stream s m Char => ParsecT s u m Modifier
- debugLogDecl :: (Stream s (WriterT Config m) Char, Monad m) => ParsecT s u (WriterT Config m) ()
- ignoreLine :: Stream s m Char => ParsecT s u m ()
- parseConfig :: (Stream s (WriterT Config m) Char, Monad m) => ParsecT s u (WriterT Config m) ()
Documentation
type InputMap = [(Maybe String, String, Event)] Source
Mappings from input bytes to event in the order specified. Later entries take precedence over earlier in the case multiple entries have the same byte string.
Config | |
|
singleEscPeriod :: Config -> Int Source
AKA VTIME. The default is 100000 microseconds or 0.1 seconds. Set using the
specifiedEscPeriod
field of Config
type ConfigParser s a = ParsecT s () (Writer Config) a Source
userConfig :: IO Config Source
Config from
and getAppUserDataDirectory
/config$VTY_CONFIG_FILE
parseConfigFile :: FilePath -> IO Config Source
configLanguage :: Stream s m Char => GenLanguageDef s u m Source
configLexer :: Stream s m Char => GenTokenParser s u m Source
debugLogDecl :: (Stream s (WriterT Config m) Char, Monad m) => ParsecT s u (WriterT Config m) () Source
ignoreLine :: Stream s m Char => ParsecT s u m () Source