浏览代码

Merge pull request #1928 from dongweiming/add-hist-stamp

Add option for show in the command execution time stamp in the history
Robby Russell 11 年之前
父节点
当前提交
44c7fd976b
共有 2 个文件被更改,包括 17 次插入2 次删除
  1. 12 2
      lib/aliases.zsh
  2. 5 0
      templates/zshrc.zsh-template

+ 12 - 2
lib/aliases.zsh

@@ -13,8 +13,18 @@ alias please='sudo'
 #alias g='grep -in'
 #alias g='grep -in'
 
 
 # Show history
 # Show history
-alias history='fc -l 1'
-
+if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
+then
+    alias history='fc -fl 1'
+elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
+then
+    alias history='fc -El 1'
+elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
+then
+    alias history='fc -il 1'
+else
+    alias history='fc -l 1'
+fi
 # List direcory contents
 # List direcory contents
 alias lsa='ls -lah'
 alias lsa='ls -lah'
 alias l='ls -la'
 alias l='ls -la'

+ 5 - 0
templates/zshrc.zsh-template

@@ -37,6 +37,11 @@ ZSH_THEME="robbyrussell"
 # much faster.
 # much faster.
 # DISABLE_UNTRACKED_FILES_DIRTY="true"
 # DISABLE_UNTRACKED_FILES_DIRTY="true"
 
 
+# Uncomment following line if you want to  shown in the command execution time stamp 
+# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
+# yyyy-mm-dd
+# HIST_STAMPS="mm/dd/yyyy"
+
 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
 # Example format: plugins=(rails git textmate ruby lighthouse)
 # Example format: plugins=(rails git textmate ruby lighthouse)