浏览代码

nixpkgs/elvish: set terminal title on cd

Thomas Dy 1 年之前
父节点
当前提交
d7fc485994

+ 1 - 0
.config/nixpkgs/elvish/lib/config.elv

@@ -2,6 +2,7 @@ use str
 use prompt
 use nix-shell
 use direlv
+use title
 use eval-export
 
 edit:add-var ls~ { |@a|

+ 1 - 1
.config/nixpkgs/elvish/lib/direlv.elv

@@ -278,4 +278,4 @@ fn on-chdir {|dir|
   }
 }
 
-set after-chdir = [$on-chdir~]
+set after-chdir = [$on-chdir~ $@after-chdir]

+ 9 - 0
.config/nixpkgs/elvish/lib/title.elv

@@ -0,0 +1,9 @@
+fn windowtitle {|t| print "\e]0;"$t"\a" }
+
+fn on-chdir {|dir|
+  windowtitle (tilde-abbr $dir)
+}
+
+windowtitle (tilde-abbr $pwd)
+
+set after-chdir = [$on-chdir~ $@after-chdir]