diff options
author | katherine <shmibs@airen-no-jikken.icu> | 2018-12-04 05:42:02 -0700 |
---|---|---|
committer | katherine <shmibs@airen-no-jikken.icu> | 2018-12-04 05:42:02 -0700 |
commit | a72dd63681f4cbb51a7e84f26b14f3a513afb542 (patch) | |
tree | 340f57d92d8491dd8e3c7b4902a5ab48994d360f /.ocamlinit | |
parent | 9f9eb66ecc74dd1535c9bba18e8783fde351a0d2 (diff) | |
download | dotfiles-a72dd63681f4cbb51a7e84f26b14f3a513afb542.tar.gz |
add a nice prompt for utop
mimics zsh
Diffstat (limited to '.ocamlinit')
-rw-r--r-- | .ocamlinit | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -1,6 +1,28 @@ #use "topfind";; -#require "core.top";; -#require "core.syntax";; +#require "core";; open Core;; + +#require "lambda-term";; + +let path = Sys.getcwd () in +let home = Sys.home_directory () in +let path = + if Zed_utf8.starts_with path home then + Zed_utf8.replace path 0 (Zed_utf8.length home) "~" + else + path +in +let version = Sys.ocaml_version in +let host = Unix.gethostname () in +let formatted = LTerm_text.eval + [B_bold true; + B_fg (LTerm_style.white); S "ā["; + B_fg (LTerm_style.lmagenta); S (Printf.sprintf "ocaml-%s" version); + B_fg (LTerm_style.lyellow); S "@"; + B_fg (LTerm_style.lmagenta); S (Printf.sprintf "%s " 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);; + |