-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc.template
39 lines (33 loc) · 1.22 KB
/
zshrc.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# oh-my-zsh configuration
export ZSH="/Users/ben/.oh-my-zsh"
ZSH_THEME="mine"
# capture all commands to a log file
export ZSH_LOGS=~/.zsh_logs
[[ -d ${ZSH_LOGS} ]] || mkdir ${ZSH_LOGS}
export LOG_ZSH_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") | $(pwd) | $(history -1 | cut -c 8-)" >> ${ZSH_LOGS}/zsh-history-$(date "+%Y-%m-%d").log; fi'
precmd() { eval "$LOG_ZSH_COMMAND" }
# Grep though command logs
function hg { grep "$1" ${ZSH_LOGS}/*.log }
function hg1 { grep "$1" ${ZSH_LOGS}/zsh-history-$(date "+%Y-%m-%d").log; }
# mark and jump directories
# https://www.datascienceworkshops.com/blog/quickly-navigate-your-filesystem-from-the-command-line/
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -if "$MARKPATH/$1"
}
function marks {
ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/ -/g' && echo
}
# Aliases
alias ls='ls -G'
alias ll='ls -lGa'
# Don't require escaping globbing characters in zsh.
unsetopt nomatch
# Tell homebrew to not autoupdate every single time I run it (just once a week).
export HOMEBREW_AUTO_UPDATE_SECS=604800