summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/settings/zsh.nix6
-rw-r--r--user/zsh/zshrc.darwin26
2 files changed, 31 insertions, 1 deletions
diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix
index ca13f4d0..b7232041 100644
--- a/user/settings/zsh.nix
+++ b/user/settings/zsh.nix
@@ -237,7 +237,11 @@ in
       source ${pkgs.fzf}/share/fzf/key-bindings.zsh
       source ${pkgs.fzf}/share/fzf/completion.zsh
 
-    '' + builtins.readFile ../zsh/zshrc;
+    '' + builtins.readFile ../zsh/zshrc + (
+      if stdenv.isDarwin
+      then builtins.readFile ../zsh/zshrc.darwin
+      else ""
+    );
   };
 
   home.file."${zshrc}".onChange =
diff --git a/user/zsh/zshrc.darwin b/user/zsh/zshrc.darwin
new file mode 100644
index 00000000..1b702022
--- /dev/null
+++ b/user/zsh/zshrc.darwin
@@ -0,0 +1,26 @@
+set_title () {
+  print -Pn "\e]0;$1\7\n"
+}
+ssh () {
+  local arg server retval
+  for arg
+  do
+    if [[ "${arg#-}" == "$arg" ]]
+    then
+      server=$arg
+      break
+    fi
+  done
+  set_title "file://${server}/"
+  command ssh "$@"
+  retval=$?
+  set_title
+  return $retval
+}
+mosh () {
+  command mosh "$@"
+  retval=$?
+  set_title
+  return $retval
+}
+