A simplified configuration interface for Yi.
- data ConfigM a
- configMain :: Config -> ConfigM () -> IO ()
- type Field a = Accessor Config a
- (%=) :: Field a -> a -> ConfigM ()
- get :: Field a -> ConfigM a
- modify :: Field a -> (a -> a) -> ConfigM ()
- setFrontendPreferences :: [String] -> ConfigM ()
- setFrontend :: String -> ConfigM ()
- globalBindKeys :: Keymap -> ConfigM ()
- modeBindKeys :: Mode syntax -> Keymap -> ConfigM ()
- modeBindKeysByName :: String -> Keymap -> ConfigM ()
- addMode :: Mode syntax -> ConfigM ()
- modifyMode :: Mode syntax -> (forall syntax'. Mode syntax' -> Mode syntax') -> ConfigM ()
- modifyModeByName :: String -> (forall syntax. Mode syntax -> Mode syntax) -> ConfigM ()
- evaluator :: Field Evaluator
- ghciEvaluator :: Evaluator
- publishedActionsEvaluator :: Evaluator
- publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
- publishedActions :: Field (HashMap String Action)
- fontName :: Field (Maybe String)
- fontSize :: Field (Maybe Int)
- scrollWheelAmount :: Field Int
- scrollStyle :: Field (Maybe ScrollStyle)
- data ScrollStyle
- cursorStyle :: Field CursorStyle
- data CursorStyle
- data Side
- scrollBarSide :: Field Side
- autoHideScrollBar :: Field Bool
- autoHideTabBar :: Field Bool
- lineWrap :: Field Bool
- windowFill :: Field Char
- theme :: Field Theme
- layoutManagers :: Field [AnyLayoutManager]
- debug :: Field Bool
- runOnStartup :: Action -> ConfigM ()
- runAfterStartup :: Action -> ConfigM ()
- startActions :: Field [Action]
- initialActions :: Field [Action]
- defaultKm :: Field KeymapSet
- inputPreprocess :: Field (P Event Event)
- modes :: Field [AnyMode]
- regionStyle :: Field RegionStyle
- killringAccumulate :: Field Bool
- bufferUpdateHandler :: Field [[Update] -> BufferM ()]
- module Yi.Boot
- module Yi.Core
- module Yi.Dired
- module Yi.File
- module Yi.Config
- module Yi.Config.Default
- module Yi.Layout
- module Yi.Search
- module Yi.Style
- module Yi.Style.Library
- module Yi.Misc
- module Yi.Mode.Haskell
This module provides a simple configuration API, allowing users to start with an initial
configuration and imperatively (monadically) modify it. Some common actions (keybindings,
selecting modes, choosing the frontend) have been given special commands (
addMode, and so on).
A simple configuration might look like the following:
import Yi.Config.Simple import qualified Yi.Mode.Haskell as Haskell -- note: don't import Yi, or else there will be name clashes main =
setFrontendPreferences[pango, vte, vty]
reversebar = do lms <-
The configuration monad. Run it with
Starts with the given initial config, makes the described modifications, then starts yi.
Sets the frontend to the first frontend from the list which is installed.
Available frontends are a subset of: "vte", "vty", "pango", "cocoa", and "batch".
Modes, commands, and keybindings
Adds the given key bindings to the `global keymap'. The bindings will override existing bindings in the case of a clash.
modeBindKeys mode keys adds the keybindings in
keys to all modes with the same name as
modifyMode, a mode by the given name must already be registered, or the function will
have no effect, and issue a command-line warning.
modeBindKeysByName name keys adds the keybindings in
keys to all modes with name
name (if it is registered). Consider using
Register the given mode. It will be preferred over any modes already defined.
modifyMode mode f modifies all modes with the same name as
mode, using the function
Note that the
mode argument is only used by its
modeName. In particular, a mode by the given name
must already be registered, or this function will have no effect, and issue a command-line warning.
modifyModemode f =
modifyModeByName name f modifies the mode with name
name using the function
f. Consider using
Evaluation of commands
Evaluator implemented by calling GHCi. This evaluator can run arbitrary expressions in the class
The following two imports are always present:
import Yi import qualified Yi.Keymap as Yi.Keymap
Also, if the file
exists, it is imported unqualified.
Evaluator based on a fixed list of published actions. Has a few differences from
- expressions can't be evaluated
- all suggested actions are actually valued
- (related to the above) doesn't contain junk actions from Prelude
- doesn't require GHCi backend, so uses less memory
Publish the given action, by the given name. This will overwrite any existing actions by the same name.
Accessor for the published actions. Consider using
When should we use a "fat" cursor (i.e. 2 pixels wide, rather than 1)? Fat cursors have only been implemented for the Pango frontend.
The character with which to fill empty window space. Usually '~' for vi-like editors, ' ' for everything else.
List of registered layout managers. When cycling through layouts, this list will be consulted.
Run when the editor is started (this is run after all actions which have already been registered)
Run after the startup actions have completed, or on reload (this is run after all actions which have already been registered)
These fields are here for completeness -- that is, to expose all the functionality of the Yi.Config module. However, most users probably need not use these fields, typically because they provide advanced functinality, or because a simpler interface for the common case is available above.
Actions to run when the editor is started. Consider using
Actions to run after startup or reload. Consider using