I'm using ghci 6.8.2 on Ubuntu. Does ghci use a configuration file where we can do some initial setup?. E.g.: :set prompt "ghci> "
.
Asked
Active
Viewed 9,611 times
53

Russia Must Remove Putin
- 374,368
- 89
- 403
- 331

rturrado
- 7,699
- 6
- 42
- 62
4 Answers
75
-
Sorry for such a basic question, but I can't understand: What is the full name of the .ghci file? And where exactly to put that file? I tried putting this file in the neighbourhood of a haskell code file, but the ghci didn't seem to read that .ghci file. – awllower Feb 26 '15 at 05:14
-
In Windows, you put the file in your user directory. E.g. `C:\Users\YourUsername\`. – MasterMastic Apr 02 '15 at 08:09
47
Having applied @hvr's answer I got the following warning:
*** WARNING: ~/.ghci is writable by someone else, IGNORING!
The solution is chmod g-w ~/.ghci
.

schuelermine
- 1,958
- 2
- 17
- 31

sjakobi
- 3,546
- 1
- 25
- 43
1
In my ~/.ghci
configuration file. I have the following line:
:set prompt "\ESC[0;34m\STX%s\n\ESC[1;31m\STXλ> \ESC[m\STX"
And here is how my ghci
prompt looks like:
https://asciinema.org/a/Tpk5430dPqCRN0cFqi1ucaCb8
In that config file, I temporarily commented out :set +m
.

daparic
- 3,794
- 2
- 36
- 38
-
That nice lambda doesn't work for me in ghci, while it does work in my terminal :/ – xeruf Mar 04 '21 at 16:40
-
adding it to `~/.ghci` did absolutely nothing for me - GHCi says `Loaded GHCi configuration from /home/
/.ghci` but the prompt didn't change :/ – xeruf Mar 04 '21 at 16:51
0
In @truthadjustr's answer the prelude comes every time you run any command.
:set prompt "\ESC[1;31m\STXλ> \ESC[m\STX"
This command solves the problem.