forked from exvim/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghci
25 lines (25 loc) · 1.45 KB
/
ghci
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
:set prompt "\ESC[34m\STX%s > \ESC[m\STX"
:def! rr \_ -> return ":script ~/.ghci"
-- :{
-- dotGHCI_myPrompt promptString ms _ = do
-- -- Get the current directory, replacing $HOME with a '~'.
-- pwd <- getpwd
-- -- Determine which is the main module.
-- let main_module = head' [ m' | (m:m') <- ms, m == '*' ]
-- -- Put together the final prompt string.
-- -- ANSI escape sequences allow for displaying colours in compatible terminals. See [http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html this guide] for help interpreting them.
-- return $ concat [ "\ESC[33m\STX", pwd, main_module, "\ESC[37m\STX", promptString, " \ESC[0m\STX" ]
-- where
-- head' (x:_) = " \ESC[38;5;227m\STX" ++ x
-- head' _ = ""
-- getpwd = getpwd' <$> System.Environment.getEnv "HOME" <*> System.Posix.getWorkingDirectory
-- getpwd' home pwd = if zipWith const pwd home == home
-- then '~':drop (length home) pwd
-- else pwd
-- :}
-- :set prompt-function dotGHCI_myPrompt "\ESC[38;5;129m\STX\xe61f"
-- :set prompt-cont-function dotGHCI_myPrompt "∷"
dotGHCI_escapeShellArg arg = "'" ++ concatMap (\c -> if c == '\'' then "'\\''" else [c]) arg ++ "'"
:def! hoogle return . (":!hoogle -q --count=15 --color " ++) . dotGHCI_escapeShellArg
:def! search return . (":!hoogle -q --count=3 --color " ++) . dotGHCI_escapeShellArg
:def! doc return . (":!hoogle -q --color --info " ++) . dotGHCI_escapeShellArg