{-# OPTIONS_HADDOCK show-extensions #-}

-- |
-- Module      :  Yi.Config
-- License     :  GPL-2
-- Maintainer  :  yi-devel@googlegroups.com
-- Stability   :  experimental
-- Portability :  portable
--
-- Module exposing common user settings. Users most likely want to be starting
-- with "Yi.Config.Default".

module Yi.Config ( Config(..), UIConfig(..), UIBoot, CursorStyle(..)
                 , module Yi.Config.Lens
                 , configStyle, configFundamentalMode, configTopLevelKeymap
                 ) where

import Data.Prototype (extractValue)
import Yi.Config.Lens
import Yi.Style       (UIStyle)
import Yi.Types       (AnyMode, Config (..), CursorStyle (..), Keymap,
                       UIBoot, UIConfig (..), extractTopKeymap)

configStyle :: UIConfig -> UIStyle
configStyle :: UIConfig -> UIStyle
configStyle = Proto UIStyle -> UIStyle
forall t. Proto t -> t
extractValue (Proto UIStyle -> UIStyle)
-> (UIConfig -> Proto UIStyle) -> UIConfig -> UIStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UIConfig -> Proto UIStyle
configTheme

configFundamentalMode :: Config -> AnyMode
configFundamentalMode :: Config -> AnyMode
configFundamentalMode = [AnyMode] -> AnyMode
forall a. [a] -> a
last ([AnyMode] -> AnyMode)
-> (Config -> [AnyMode]) -> Config -> AnyMode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Config -> [AnyMode]
modeTable

configTopLevelKeymap :: Config -> Keymap
configTopLevelKeymap :: Config -> Keymap
configTopLevelKeymap = KeymapSet -> Keymap
extractTopKeymap (KeymapSet -> Keymap) -> (Config -> KeymapSet) -> Config -> Keymap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Config -> KeymapSet
defaultKm