-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
112 lines (93 loc) · 3.27 KB
/
zshrc
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
HISTFILE=~/.histfile
HISTSIZE=1000000
SAVEHIST=10000000
#TODO set up histfile rotation >2000 lines
setopt appendhistory autocd extendedglob notify
zstyle :compinstall filename '/Users/djoh68/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# ls colors
autoload -U colors && colors
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
if [[ "$(uname -s)" == "NetBSD" ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
# with color and multibyte support) are available from ports. "colorls"
# will be installed on purpose and can't be pulled in by installing
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
else
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi
fi
#setopt no_beep
setopt auto_cd
setopt multios
setopt cdablevars
if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
fi
# Apply theming defaults
PS1="mbp:%~ %# "
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
# Setup the prompt with pretty colors
setopt prompt_subst
# from http://dougblack.io/words/zsh-vi-mode.html
#bindkey -v
[[ -z "$terminfo[kcuu1]" ]] || bindkey "^[[A" up-line-or-history #"$terminfo[kcuu1]" up-line-or-history
[[ -z "$terminfo[kcud1]" ]] || bindkey "^[[B" down-line-or-history #""$terminfo[kcud1]" down-line-or-history
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
function zle-line-init zle-keymap-select {
VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/}$EPS1" #$(git_custom_status)
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
export KEYTIMEOUT=1
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/djoh68/.local/lib/aws/bin:/Users/djoh68/nike/bin
# aliases and helper functions
alias ll='ls -ltr'
alias history='history 1'
#alias hrep='history 1|grep '
function hrep () {
if [ "$1" ]
then
fc -l 1|grep "$1" -
fi
}
alias gits='git status'
alias gita='git add'
alias gitb='git branch'
#TODO integrate this with geeknote/evernote
function note () {
if [ "$1" ]
then
filename="`date +%Y-%m-%d`_$1"
else
filename="temp_`date +%Y-%m-%d`_$RANDOM"
fi
echo -e "\033]50;SetProfile=Note\a"
vim ~/nike/notes/${filename}.txt
}