From 64aafd4447b5edff4422ba3693cfb8c354d22c9f Mon Sep 17 00:00:00 2001 From: Mika Suomalainen Date: Mon, 31 Dec 2012 23:00:59 +0200 Subject: [PATCH] bashrc & zshrc: (almost) unlimited history + time stamps in history --- bashrc | 13 ++++++++++--- zshrc | 16 +++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/bashrc b/bashrc index f64f9841..f78cb704 100644 --- a/bashrc +++ b/bashrc @@ -21,14 +21,21 @@ fi" > ~/.bash_profile # don't put duplicate lines in the history. See bash(1) for more options # ... or force ignoredups and ignorespace -HISTCONTROL=ignoredups:ignorespace +HISTCONTROL=ignoredups # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 +export HISTSIZE= +export HISTFILESIZE= + +export HISTTIMEFORMAT='%F %T ' + +HISTFILE=~/.history +export APPEND_HISTORY= +export SHARE_HISTORY= + # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. diff --git a/zshrc b/zshrc index 7ba20b69..d54e0c6b 100644 --- a/zshrc +++ b/zshrc @@ -20,15 +20,18 @@ promptinit PS1="%B%(!.%F{red}.%F{green})%n@%m %~ %#%f%b " -setopt histignorealldups sharehistory +setopt histignorealldups sharehistory APPEND_HISTORY SHARE_HISTORY # Use emacs keybindings even if our EDITOR is set to vi bindkey -e -# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: -HISTSIZE=1000 -SAVEHIST=1000 -HISTFILE=~/.zsh_history +HISTCONTROL=ignoredups +export HISTSIZE=9999999999 +export HISTFILESIZE=99999999999 +export HISTTIMEFORMAT='%F %T ' +HISTFILE=~/.history +export APPEND_HISTORY= +export SHARE_HISTORY= # Use modern completion system autoload -Uz compinit @@ -351,6 +354,9 @@ alias ex-tarbz2="tar xfvj " alias info="echo 'I don't know anyone who likes and uses info pages, so I aliased this to pinfo. If you don't have it installed, you should install it! To override this alias run: \info ' && pinfo " +# For getting timestamps in history +alias history="history -i " + # To have less handle ls colours alias less="less -R "