aboutsummaryrefslogtreecommitdiffstats
path: root/.ocamlinit
blob: f03d1c6740f004e60a48cb0ef343d43fbea1c246 (plain)
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
#use "topfind";;
#thread;;

#require "core";;
#require "core_unix";;

open Core;;

#require "lambda-term";;

let path = Core_unix.getcwd () in
let home = Sys.getenv_exn "HOME" in
let path =
  if Zed_utf8.starts_with path home then
    Zed_utf8.replace path 0 (Zed_utf8.length home) "~"
  else
    path
in 
let user = Core_unix.getlogin () in
let version = Sys.ocaml_version in
let host = Core_unix.gethostname () in
let formatted = LTerm_text.eval
  [B_bold true;
   B_fg (LTerm_style.white); S "ā”Œ[";
   B_fg (LTerm_style.lyellow); S (Printf.sprintf "%s@" user);
   S (Printf.sprintf "ocaml-%s@%s " version host);
   B_fg (LTerm_style.lcyan); S (Printf.sprintf "%s" path);
   B_fg (LTerm_style.white); S "]\nā””: "]
in UTop.prompt := fst (React.S.create formatted);;