module Yi.Config.Users.Anders (config) where
import Yi hiding (Block, (.))
import qualified Yi.Mode.Haskell as H
import Yi.Hoogle (hoogle)
import Yi.String (mapLines)
import Yi.Modes (removeAnnots)
config :: Config
config = defaultEmacsConfig
increaseIndent :: BufferM ()
increaseIndent = do
r <- getSelectRegionB
r' <- unitWiseRegion Yi.Line r
modifyRegionB (mapLines (' ':)) r'
main :: IO ()
main = yi $ config
{ defaultKm = defaultKm config
, startFrontEnd = startFrontEnd config
, modeTable =
AnyMode (haskellModeHooks H.preciseMode)
: AnyMode (haskellModeHooks noAnnots)
: modeTable defaultConfig
}
haskellModeHooks mode =
mode { modeName = "my " ++ modeName mode
, modeKeymap =
topKeymapA ^: ((ctrlCh 'c' ?>>
choice [ ctrlCh 'l' ?>>! H.ghciLoadBuffer
, ctrl (char 'z') ?>>! H.ghciGet
, ctrl (char 'h') ?>>! hoogle
, ctrlCh 'r' ?>>! H.ghciSend ":r"
, ctrlCh 't' ?>>! H.ghciInferType
, ctrlCh 'n' ?>>! increaseIndent
])
<||) }
noAnnots = removeAnnots (H.preciseMode {modeName = "preciseNoUnicode"})