-
Notifications
You must be signed in to change notification settings - Fork 3
/
yi.hs
46 lines (40 loc) · 1.7 KB
/
yi.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Yi
import Yi.Misc (adjIndent)
import qualified Yi.Keymap.Vim as V
import qualified Yi.Mode.Haskell as H
import Yi.Prelude
import Yi.Hoogle (hoogle,hoogleSearch)
import Yi.Keymap.Keys
import Yi.UI.Vty (start)
import Data.Monoid
bestHaskellMode = H.cleverMode { modeKeymap = (choice haskellModeKeys <||) }
haskellModeKeys = [ ctrlCh 'c' ?>> char 'g' ?>>! H.ghciLoadBuffer
, ctrlCh 'c' ?>> char 'l' ?>>! H.ghciGet
, ctrlCh 'c' ?>> char 'h' ?>>! hoogle
, ctrlCh 'c' ?>> char 's' ?>>! hoogleSearch
]
main :: IO ()
main = yi $ defaultConfig
{ configKillringAccumulate = False
, startFrontEnd = start
, modeTable = AnyMode bestHaskellMode : modeTable defaultConfig
, configUI = (configUI defaultConfig)
{ configWindowFill = '~'
, configTheme = defaultLightTheme `override` \super' _ -> super'
{ selectedStyle = Endo $ \a -> a {foreground = black, background = white} }
}
, defaultKm = V.mkKeymap aleks'vimKeymap
-- , defaultKm = E.keymap
}
aleks'vimKeymap :: Proto V.ModeMap
aleks'vimKeymap = V.defKeymap `override` \super' self -> super'
{ V.v_top_level = (deprioritize >> V.v_top_level super')
<|> (char 'o' ?>> V.beginIns self $
do moveToEol
insertB '\n'
adjIndent IncreaseOnly)
, V.v_ins_char = (deprioritize >> V.v_ins_char super')
<|> ( spec KEnter ?>>!
do insertB '\n'
adjIndent IncreaseOnly)
}