aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkatherine <shmibs@airen-no-jikken.icu>2018-12-04 05:42:02 -0700
committerkatherine <shmibs@airen-no-jikken.icu>2018-12-04 05:42:02 -0700
commita72dd63681f4cbb51a7e84f26b14f3a513afb542 (patch)
tree340f57d92d8491dd8e3c7b4902a5ab48994d360f
parent9f9eb66ecc74dd1535c9bba18e8783fde351a0d2 (diff)
downloaddotfiles-a72dd63681f4cbb51a7e84f26b14f3a513afb542.tar.gz
add a nice prompt for utop
mimics zsh
-rw-r--r--.ocamlinit26
-rw-r--r--.zshrc14
2 files changed, 34 insertions, 6 deletions
diff --git a/.ocamlinit b/.ocamlinit
index da23674..67acc2b 100644
--- a/.ocamlinit
+++ b/.ocamlinit
@@ -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);;
+
diff --git a/.zshrc b/.zshrc
index 1f6971c..24985ff 100644
--- a/.zshrc
+++ b/.zshrc
@@ -51,8 +51,12 @@ PROMPT="%{$fg[black]%}ā”Œ["
PROMPT+="%(0?..$fg[red]%?$fg[black]:)"
# if any, number of jobs
PROMPT+="%(1j.$fg[green]%j$fg[black]:.)"
-# name and host (red for root)
-PROMPT+="%{%(!.$fg[red].$fg[magenta])%}%n@%M%E "
+# # name and host (red for root)
+# PROMPT+="%{%(!.$fg[red].$fg[magenta])%}%n@%M%E "
+# name (red for root)
+PROMPT+="%{%(!.$fg[red].$fg[magenta])%}%n"
+# host
+PROMPT+="%{$fg[yellow]%}@%{$fg[magenta]%}%M%E "
# current location, with one level of parent context
PROMPT+="%{$fg[blue]%}%2c"
# newline
@@ -65,8 +69,10 @@ PROMPT="%{%B$fg[white]%}ā”Œ["
PROMPT+="%(0?..$fg[red]%?$fg[white]:)"
# if any, number of jobs
PROMPT+="%(1j.$fg[green]%j$fg[white]:.)"
-# name and host (red for root)
-PROMPT+="%{%(!.$fg[red].$fg[magenta])%}%n@%M%E "
+# name (red for root)
+PROMPT+="%{%(!.$fg[red].$fg[magenta])%}%n"
+# host
+PROMPT+="%{$fg[yellow]%}@%{$fg[magenta]%}%M%E "
# current location, with one level of parent context
PROMPT+="%{$fg[blue]%}%2c"
# newline