浏览代码

Allow arguments to `d` to be passed to dirs

Replace the alias with a function. Call `dirs` if arguments are given to `d`.
Ben Klein 6 年之前
父节点
当前提交
b0a149076f
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      lib/directories.zsh

+ 8 - 1
lib/directories.zsh

@@ -21,7 +21,14 @@ alias 9='cd -9'
 
 alias md='mkdir -p'
 alias rd=rmdir
-alias d='dirs -v | head -10'
+function d () {
+  if [[ -n $1 ]]; then
+    dirs "$@"
+  else
+    dirs -v | head -10
+  fi
+}
+compdef _dirs d
 
 # List directory contents
 alias lsa='ls -lah'