diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e6644d..76d3bcb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,18 +1,29 @@ #!/bin/sh # sourced by .zshrc +# GNU or OS-X ls +if ls --color > /dev/null 2>&1; then + colorflag="--color" +else + colorflag="-G" +fi + # enable color support -alias ls='ls -G' +alias ls='ls ${colorflag}' # some more ls aliases -alias l.='ls -d .*' -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias l.='ls -d .* ${colorflag}' +alias ll='ls -alF ${colorflag}' +alias la='ls -A ${colorflag}' +alias l='ls -CF ${colorflag}' alias httpserver='python -m http.server' alias vi=vim alias pgrep='ps -eo "%p %c %U %C" | grep' alias nano='nano -m' +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + alias elasticsearch=~/Development/elasticsearch-1.5.2/bin/elasticsearch diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e6644d..76d3bcb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,18 +1,29 @@ #!/bin/sh # sourced by .zshrc +# GNU or OS-X ls +if ls --color > /dev/null 2>&1; then + colorflag="--color" +else + colorflag="-G" +fi + # enable color support -alias ls='ls -G' +alias ls='ls ${colorflag}' # some more ls aliases -alias l.='ls -d .*' -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias l.='ls -d .* ${colorflag}' +alias ll='ls -alF ${colorflag}' +alias la='ls -A ${colorflag}' +alias l='ls -CF ${colorflag}' alias httpserver='python -m http.server' alias vi=vim alias pgrep='ps -eo "%p %c %U %C" | grep' alias nano='nano -m' +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + alias elasticsearch=~/Development/elasticsearch-1.5.2/bin/elasticsearch diff --git a/zsh/exports.zsh b/zsh/exports.zsh index 33235be..fcb4fe4 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -14,4 +14,6 @@ export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[1;32m' +export KEYTIMEOUT=1 + export ANDROID_HOME=/usr/local/opt/android-sdk diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e6644d..76d3bcb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,18 +1,29 @@ #!/bin/sh # sourced by .zshrc +# GNU or OS-X ls +if ls --color > /dev/null 2>&1; then + colorflag="--color" +else + colorflag="-G" +fi + # enable color support -alias ls='ls -G' +alias ls='ls ${colorflag}' # some more ls aliases -alias l.='ls -d .*' -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias l.='ls -d .* ${colorflag}' +alias ll='ls -alF ${colorflag}' +alias la='ls -A ${colorflag}' +alias l='ls -CF ${colorflag}' alias httpserver='python -m http.server' alias vi=vim alias pgrep='ps -eo "%p %c %U %C" | grep' alias nano='nano -m' +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + alias elasticsearch=~/Development/elasticsearch-1.5.2/bin/elasticsearch diff --git a/zsh/exports.zsh b/zsh/exports.zsh index 33235be..fcb4fe4 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -14,4 +14,6 @@ export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[1;32m' +export KEYTIMEOUT=1 + export ANDROID_HOME=/usr/local/opt/android-sdk diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 1a9f59e..09bf66f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -68,6 +68,11 @@ } # -hgrep() { +function hgrep() { history | grep $*; } + +function hist() { + history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head +} + diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e6644d..76d3bcb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,18 +1,29 @@ #!/bin/sh # sourced by .zshrc +# GNU or OS-X ls +if ls --color > /dev/null 2>&1; then + colorflag="--color" +else + colorflag="-G" +fi + # enable color support -alias ls='ls -G' +alias ls='ls ${colorflag}' # some more ls aliases -alias l.='ls -d .*' -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias l.='ls -d .* ${colorflag}' +alias ll='ls -alF ${colorflag}' +alias la='ls -A ${colorflag}' +alias l='ls -CF ${colorflag}' alias httpserver='python -m http.server' alias vi=vim alias pgrep='ps -eo "%p %c %U %C" | grep' alias nano='nano -m' +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + alias elasticsearch=~/Development/elasticsearch-1.5.2/bin/elasticsearch diff --git a/zsh/exports.zsh b/zsh/exports.zsh index 33235be..fcb4fe4 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -14,4 +14,6 @@ export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[1;32m' +export KEYTIMEOUT=1 + export ANDROID_HOME=/usr/local/opt/android-sdk diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 1a9f59e..09bf66f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -68,6 +68,11 @@ } # -hgrep() { +function hgrep() { history | grep $*; } + +function hist() { + history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head +} + diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index a90eb77..7678b62 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -19,10 +19,16 @@ fi } +function zle-line-init zle-keymap-select { + VIM_NORMAL="%{%F{yellow}%} [% NORMAL]% %{$reset_color%}" + RPROMPT="${${KEYMAP/vicmd/$VIM_NORMAL}/(main|viins)/} $EPS1" + zle reset-prompt +} + PROMPT_HOST='%{%F{yellow}%K{black}%} %n %{%F{black}%}' PROMPT_DIR='%{%F{black}%} %~% ' PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})%{%f%k%b%}' PROMPT='%{%f%b%k%}$PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU ❯ ' -RPROMPT='%(?.%{%F{green}%}✔.%{%F{red}%}✘)' + diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e6644d..76d3bcb 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,18 +1,29 @@ #!/bin/sh # sourced by .zshrc +# GNU or OS-X ls +if ls --color > /dev/null 2>&1; then + colorflag="--color" +else + colorflag="-G" +fi + # enable color support -alias ls='ls -G' +alias ls='ls ${colorflag}' # some more ls aliases -alias l.='ls -d .*' -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias l.='ls -d .* ${colorflag}' +alias ll='ls -alF ${colorflag}' +alias la='ls -A ${colorflag}' +alias l='ls -CF ${colorflag}' alias httpserver='python -m http.server' alias vi=vim alias pgrep='ps -eo "%p %c %U %C" | grep' alias nano='nano -m' +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + alias elasticsearch=~/Development/elasticsearch-1.5.2/bin/elasticsearch diff --git a/zsh/exports.zsh b/zsh/exports.zsh index 33235be..fcb4fe4 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -14,4 +14,6 @@ export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[1;32m' +export KEYTIMEOUT=1 + export ANDROID_HOME=/usr/local/opt/android-sdk diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 1a9f59e..09bf66f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -68,6 +68,11 @@ } # -hgrep() { +function hgrep() { history | grep $*; } + +function hist() { + history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head +} + diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index a90eb77..7678b62 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -19,10 +19,16 @@ fi } +function zle-line-init zle-keymap-select { + VIM_NORMAL="%{%F{yellow}%} [% NORMAL]% %{$reset_color%}" + RPROMPT="${${KEYMAP/vicmd/$VIM_NORMAL}/(main|viins)/} $EPS1" + zle reset-prompt +} + PROMPT_HOST='%{%F{yellow}%K{black}%} %n %{%F{black}%}' PROMPT_DIR='%{%F{black}%} %~% ' PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})%{%f%k%b%}' PROMPT='%{%f%b%k%}$PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU ❯ ' -RPROMPT='%(?.%{%F{green}%}✔.%{%F{red}%}✘)' + diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 6f10bfb..88c48d0 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -19,9 +19,9 @@ compinit # History -HISTFILE=~/.zsh_history -HISTSIZE=10000 -SAVEHIST=10000 +export HISTFILE=~/.zsh_history +export HISTSIZE=10000 +export SAVEHIST=10000 setopt SHARE_HISTORY setopt HIST_IGNORE_ALL_DUPS @@ -29,6 +29,11 @@ setopt COMPLETE_ALIASES +# Vi mode +bindkey -v +zle -N zle-line-init +zle -N zle-keymap-select + # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"