From 13d26030b2f7bacb3ab329f433be0a538ab61f55 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Thu, 3 May 2018 19:01:25 +0200 Subject: migrate to oh_my_zsh --- home/.zshrc | 253 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ home/.zshrc.local | 165 ----------------------------------- src/zshrc.sh | 8 -- 3 files changed, 253 insertions(+), 173 deletions(-) create mode 100644 home/.zshrc delete mode 100644 home/.zshrc.local delete mode 100755 src/zshrc.sh diff --git a/home/.zshrc b/home/.zshrc new file mode 100644 index 0000000..5cc85bb --- /dev/null +++ b/home/.zshrc @@ -0,0 +1,253 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH=/home/astra/.oh-my-zsh + +# Set name of the theme to load. Optionally, if you set this to "random" +# it'll load a random theme each time that oh-my-zsh is loaded. +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +#ZSH_THEME="afowler" +#ZSH_THEME="agnoster" +#ZSH_THEME="bira" +ZSH_THEME="obraun" + +# Set list of themes to load +# Setting this variable when ZSH_THEME=random +# cause zsh load theme from this variable instead of +# looking in ~/.oh-my-zsh/themes/ +# An empty array have no effect +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. Case +# sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# 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/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git mvn +) + +[ -d $ZSH ] && source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/rsa_id" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +HISTFILE=~/.histfile +HISTSIZE=65536 +SAVEHIST=65536 +eval `dircolors -b` + +# Timestamps in history +setopt extended_history +setopt appendhistory +unsetopt share_history +setopt inc_append_history +setopt hash_cmds +setopt hash_dirs +setopt hash_list_all +setopt correct +setopt hist_reduce_blanks +setopt multios +unsetopt beep +unsetopt nomatch +bindkey -e + +# auto-escape chars when typing urls +autoload -Uz url-quote-magic +zle -N self-insert url-quote-magic + +# auto-escape chars when pasting urls +autoload -Uz bracketed-paste-magic +zle -N bracketed-paste bracketed-paste-magic + +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' '*?.class' + +# add ~/bin to path +if ! [[ $PATH =~ "${HOME}/bin" ]]; then + PATH="${PATH}:${HOME}/bin" +fi + +exec_exists() { type -p $1 &>/dev/null } +exec_exists hostname && HOSTNAME=`hostname` +main_node() { [[ "$HOSTNAME" == "anduin" ]] } + +# Vars used later on by Zsh +export EDITOR="vim -p" +export PAGER="less" + +# command B equivalent to command &> /dev/null & +alias -g B='&> /dev/null &' + +export PYTHONSTARTUP=~/.pythonrc + +if main_node; then + export PATH=/home/astra/var/AndroidSDK/sdk/platform-tools:$PATH + + export BROWSER="firefox" + + export BATTERY=1 + export XDG_CURRENT_DESKTOP=kde + export CVS_RSH="ssh" +else + export BROWSER="links" + export BATTERY=0 +fi + +alias vim="vim -p" +alias gvim="gvim -p" +alias e="gvim -p" +alias v="gvim -p" +alias g="git" +exec_exists colordiff && alias diff="colordiff -u" +alias vimdiff="vimdiff -c 'map q :qa!'" +alias grep="grep -i" +alias cp="cp -i" +alias nano="nano -w" +alias route6="route -Ainet6" +alias cls='printf "\033c"' + +if main_node; then + alias gnuplot="gnuplot -persist" + alias padoff='/usr/bin/xinput disable "SynPS/2 Synaptics TouchPad"' + alias padon='/usr/bin/xinput enable "SynPS/2 Synaptics TouchPad"' + alias snownews="snownews -u" + alias biew="TERM=vt100 biew" + alias urxvt="urxvt256c" + exec_exists pm-suspend && alias vsuspend="sudo pm-suspend" + exec_exists trash && alias rm="trash" + exec_exists tmux && alias tmuxattach="tmux new -As default" + + alias pushd_list='pushd "$@"' + alias wine32='WINEARCH=win32 WINEPREFIX=/home/astra/.wine32 wine' + alias mc='ssh -p666 dev.somenet.org -L 25565:10.10.0.253:25565' + #alias xflux="/home/astra/git/f.lux/xflux -l 48.21 -g 16.37" + alias openwlans='nmcli device wifi rescan ; sleep 2 ; nmcli device wifi list | egrep -v "(WPA1|WPA2|802.1X|WEP)" | grep -v Ad-Hoc | awk "!/^ --/ {print}"' + alias venv='source `find . -wholename "*/bin/activate" | head -n1`' +fi + +if main_node; then + # just press 'asdf' keys to toggle between dvorak and us keyboard layout + #asdf() { + # echo -n 'Switching to us keyboard layout: ' + # [[ -z "$DISPLAY" ]] && $SUDO loadkeys us &>/dev/null || setxkbmap us &>/dev/null + # echo 'Done' + #} + # just press 'asdf' key to toggle from neo layout to us keyboard layout + #fdsa() { + # echo -n 'Switching to de keyboard layout: ' + # [[ -z "$DISPLAY" ]] && $SUDO loadkeys de &>/dev/null || setxkbmap de &>/dev/null + # echo 'Done' + #} + # + #neo() { + # echo -n 'Switching to neo keyboard layout: ' + # [[ -z "$DISPLAY" ]] && $SUDO loadkeys de neo &>/dev/null || setxkbmap de neo -option &>/dev/null + # echo 'Done' + #} + #eaiu() { + # echo -n 'Switching to us keyboard layout: ' + # [[ -z "$DISPLAY" ]] && $SUDO loadkeys us &>/dev/null || setxkbmap us &>/dev/null + # echo 'Done' + #} +fi + +mping(){ ping $@|awk -F'[=\ ]' '/time=/{t=$(NF-1);f=2000-14*log(t^18);c="play -q -n synth 1 pl "f"&";print $0;system(c)}';} # mping yahoo\.com +bat(){ calc \(`cat /sys/class/power_supply/BAT0/energy_now`+`cat /sys/class/power_supply/BAT1/energy_now`\)/\(`cat /sys/class/power_supply/BAT0/energy_full`+`cat /sys/class/power_supply/BAT1/energy_full`\); } # show battery state + +#pdfgrep(){ +# OLDWORKDIR=`pwd` +# TMPDIR=`mktemp -d` +# if [[ "$1" == '-r' && "$3" == "" ]]; then +# search=$2 ; shift ; shift +# filelist=`find . -name '*.pdf' -print` +# elif [[ "$1" == '-r' ]]; then +# search=$2 ; shift ; shift +# filelist=`find $* -name '*.pdf' -print` +# else +# search=$1 ; shift +# filelist=$* +# fi +# +# echo "$filelist" | while read file; do +# filedir=`dirname ${file}` +# filename=`basename ${file}` +# mkdir -p ${TMPDIR}/${filedir}/ +# pdftotext ${file} ${TMPDIR}/${filedir}/${filename%.pdf}.txt +# done +# cd ${TMPDIR} +# grep -r "${search}" . | sed 's/\.txt:/.pdf:/' +# cd ${OLDWORKDIR} +# /bin/rm -r ${TMPDIR} +#} + +[[ ! -z "$DISPLAY" ]] && [ -n "$WINDOWID" ] && exec_exists transset-df && transset-df -i $WINDOWID 0.9 >/dev/null || true + +# twitter.com/climagic +todo(){ cd ~/.todo||return 1&& l=$(ls -1t|head -n1)&&t=$(date +%Y%m%d);[[ "$1" == "last" ]]&&cp $l $t; vim $t;cd -;} + +# temp patch +cd $HOME diff --git a/home/.zshrc.local b/home/.zshrc.local deleted file mode 100644 index a10bc39..0000000 --- a/home/.zshrc.local +++ /dev/null @@ -1,165 +0,0 @@ -# Lines configured by zsh-newuser-install -HISTFILE=~/.histfile -HISTSIZE=65536 -SAVEHIST=65536 -eval `dircolors -b` - -# Timestamps in history -setopt extended_history -setopt appendhistory -unsetopt share_history -setopt inc_append_history -setopt hash_cmds -setopt hash_dirs -setopt hash_list_all -setopt correct -setopt hist_reduce_blanks -setopt multios -unsetopt beep -unsetopt nomatch -bindkey -e - -autoload -Uz compinit -compinit - -autoload colors -colors - -autoload -Uz promptinit -promptinit - -# auto-escape chars when typing urls -autoload -Uz url-quote-magic -zle -N self-insert url-quote-magic - -# auto-escape chars when pasting urls -autoload -Uz bracketed-paste-magic -zle -N bracketed-paste bracketed-paste-magic - -zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' '*?.class' - -# add ~/bin to path -if ! [[ $PATH =~ "${HOME}/bin" ]]; then - PATH="${PATH}:${HOME}/bin" -fi - -exec_exists() { type -p $1 &>/dev/null } -exec_exists hostname && HOSTNAME=`hostname` -main_node() { [[ "$HOSTNAME" == "anduin" ]] } - -# Vars used later on by Zsh -export EDITOR="vim -p" -export PAGER="less" - -# command B equivalent to command &> /dev/null & -alias -g B='&> /dev/null &' - -export PYTHONSTARTUP=~/.pythonrc - -if main_node; then - export PATH=/home/astra/var/AndroidSDK/sdk/platform-tools:$PATH - - export BROWSER="firefox" - - export BATTERY=1 - export XDG_CURRENT_DESKTOP=kde - export CVS_RSH="ssh" -else - export BROWSER="links" - export BATTERY=0 -fi - -alias vim="vim -p" -alias gvim="gvim -p" -alias e="gvim -p" -alias v="gvim -p" -alias g="git" -exec_exists colordiff && alias diff="colordiff -u" -alias vimdiff="vimdiff -c 'map q :qa!'" -alias grep="grep -i" -alias cp="cp -i" -alias nano="nano -w" -alias route6="route -Ainet6" -alias cls='printf "\033c"' - -if main_node; then - alias gnuplot="gnuplot -persist" - alias padoff='/usr/bin/xinput disable "SynPS/2 Synaptics TouchPad"' - alias padon='/usr/bin/xinput enable "SynPS/2 Synaptics TouchPad"' - alias snownews="snownews -u" - alias biew="TERM=vt100 biew" - alias urxvt="urxvt256c" - exec_exists pm-suspend && alias vsuspend="sudo pm-suspend" - exec_exists trash && alias rm="trash" - exec_exists tmux && alias tmuxattach="tmux new -As default" - - alias pushd_list='pushd "$@"' - alias wine32='WINEARCH=win32 WINEPREFIX=/home/astra/.wine32 wine' - alias mc='ssh -p666 dev.somenet.org -L 25565:10.10.0.253:25565' - #alias xflux="/home/astra/git/f.lux/xflux -l 48.21 -g 16.37" - alias openwlans='nmcli device wifi rescan ; sleep 2 ; nmcli device wifi list | egrep -v "(WPA1|WPA2|802.1X|WEP)" | grep -v Ad-Hoc | awk "!/^ --/ {print}"' - alias venv='source `find . -wholename "*/bin/activate" | head -n1`' -fi - -if main_node; then - # just press 'asdf' keys to toggle between dvorak and us keyboard layout - #asdf() { - # echo -n 'Switching to us keyboard layout: ' - # [[ -z "$DISPLAY" ]] && $SUDO loadkeys us &>/dev/null || setxkbmap us &>/dev/null - # echo 'Done' - #} - # just press 'asdf' key to toggle from neo layout to us keyboard layout - #fdsa() { - # echo -n 'Switching to de keyboard layout: ' - # [[ -z "$DISPLAY" ]] && $SUDO loadkeys de &>/dev/null || setxkbmap de &>/dev/null - # echo 'Done' - #} - # - #neo() { - # echo -n 'Switching to neo keyboard layout: ' - # [[ -z "$DISPLAY" ]] && $SUDO loadkeys de neo &>/dev/null || setxkbmap de neo -option &>/dev/null - # echo 'Done' - #} - #eaiu() { - # echo -n 'Switching to us keyboard layout: ' - # [[ -z "$DISPLAY" ]] && $SUDO loadkeys us &>/dev/null || setxkbmap us &>/dev/null - # echo 'Done' - #} -fi - -mping(){ ping $@|awk -F'[=\ ]' '/time=/{t=$(NF-1);f=2000-14*log(t^18);c="play -q -n synth 1 pl "f"&";print $0;system(c)}';} # mping yahoo\.com -bat(){ calc \(`cat /sys/class/power_supply/BAT0/energy_now`+`cat /sys/class/power_supply/BAT1/energy_now`\)/\(`cat /sys/class/power_supply/BAT0/energy_full`+`cat /sys/class/power_supply/BAT1/energy_full`\); } # show battery state - -#pdfgrep(){ -# OLDWORKDIR=`pwd` -# TMPDIR=`mktemp -d` -# if [[ "$1" == '-r' && "$3" == "" ]]; then -# search=$2 ; shift ; shift -# filelist=`find . -name '*.pdf' -print` -# elif [[ "$1" == '-r' ]]; then -# search=$2 ; shift ; shift -# filelist=`find $* -name '*.pdf' -print` -# else -# search=$1 ; shift -# filelist=$* -# fi -# -# echo "$filelist" | while read file; do -# filedir=`dirname ${file}` -# filename=`basename ${file}` -# mkdir -p ${TMPDIR}/${filedir}/ -# pdftotext ${file} ${TMPDIR}/${filedir}/${filename%.pdf}.txt -# done -# cd ${TMPDIR} -# grep -r "${search}" . | sed 's/\.txt:/.pdf:/' -# cd ${OLDWORKDIR} -# /bin/rm -r ${TMPDIR} -#} - -[[ ! -z "$DISPLAY" ]] && [ -n "$WINDOWID" ] && exec_exists transset-df && transset-df -i $WINDOWID 0.9 >/dev/null || true - -# twitter.com/climagic -todo(){ cd ~/.todo||return 1&& l=$(ls -1t|head -n1)&&t=$(date +%Y%m%d);[[ "$1" == "last" ]]&&cp $l $t; vim $t;cd -;} - -# temp patch -cd $HOME diff --git a/src/zshrc.sh b/src/zshrc.sh deleted file mode 100755 index 72d0069..0000000 --- a/src/zshrc.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# goto root dir (this script resides in src) -BASEDIR=`dirname $(readlink -f $0)` -cd ${BASEDIR}/../ - -rm -f gen/.zshrc -curl -L -s http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc -o gen/.zshrc -- cgit v1.2.3