# Sample .bashrc for SuSE Linux # Copyright (c) SuSE GmbH Nuernberg # There are 3 different types of shells in bash: the login shell, normal shell # and interactive shell. Login shells read ~/.profile and interactive shells # read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all # settings made here will also take effect in a login shell. # # NOTE: It is recommended to make language settings in ~/.profile rather than # here, since multilingual X sessions would not work properly if LANG is over- # ridden in every subshell. # Some applications read the EDITOR variable to determine your favourite text # editor. So uncomment the line below and enter the editor of your choice :-) #export EDITOR=/usr/bin/vim #export EDITOR=/usr/bin/mcedit # For some news readers it makes sense to specify the NEWSSERVER variable here #export NEWSSERVER=your.news.server # If you want to use a Palm device with Linux, uncomment the two lines below. # For some (older) Palm Pilots, you might need to set a lower baud rate # e.g. 57600 or 38400; lowest is 9600 (very slow!) # #export PILOTPORT=/dev/pilot #export PILOTRATE=115200 test -s ~/.alias && . ~/.alias || true export PATH=/home/plasmahh/local/bin/:/home/plasmahh/opt/bin:/home/plasmahh/bin:/MDPS/BIN:/opt/intel/vtune_amplifier_xe_2011/bin64:/opt/kde3/bin/:/opt/sysdig/bin/opt/sysdig/bin:/bin:/sbin/:/usr/bin:/usr/sbin/:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/local/bin:/usr/local/sbin/:$PATH shopt -s cdspell shopt -s dirspell shopt -s checkhash HISTCONTROL=ignoreboth HISTFILE=/home/plasmahh/.bash_history HISTFILESIZE=100000 HISTSIZE=100000 HISTTIMEFORMAT='%c ' function print_time( ) { NUM=$1 NUMD=${#NUM} if [[ $NUMD -gt 9 ]]; then PRE=$((NUMD-9)) PRED=${NUM:0:${PRE}} POST=${NUM:${PRE}:3} SUF="s" elif [[ $NUMD -gt 6 ]]; then PRED=$NUM PRE=$((NUMD-6)) PRED=${NUM:0:${PRE}} POST=${NUM:${PRE}:3} SUF="ms" elif [[ $NUMD -gt 3 ]]; then PRED=$NUM PRE=$((NUMD-3)) PRED=${NUM:0:${PRE}} POST=${NUM:${PRE}:3} SUF="µs" else PRED=$NUM POST="0" SUF="ns" fi printf "%s.%s%s" ${PRED} ${POST} ${SUF} } function trim_zeroes( ) { NUM=$1 while [[ ${NUM:0:1} == "0" ]]; do NUM=${NUM:1} done echo $NUM } function bark_ps0( ) { echo "BARK" } function get_time( ) { date "+%s.%N" } function stats_start( ) { if [[ "${PROMPT_COMMAND}" != *"${BASH_COMMAND}"* ]]; then TIMER_START=$(get_time) fi } function stats_stop( ) { if [[ -z "$TIMER_START" ]]; then LAST_POST_RESULT=" " return fi # echo "STOP_PROMPT_COMMAND=$PROMPT_COMMAND" # echo "BC=$BC" # echo "STOPTIME0" # echo "BASHPID=$BASHPID" # echo "STATS_STOP" # return # date +%s.%N # echo "STOP" # trap 'stats_start' DEBUG # return TIMER_END=$(get_time) TIMER_START_S=${TIMER_START:0:10} TIMER_START_NS=${TIMER_START:11:9} TIMER_END_S=${TIMER_END:0:10} TIMER_END_NS=${TIMER_END:11:9} # echo "TIMER_START=$TIMER_START" # echo "TIMER_START_S=$TIMER_START_S" # echo "TIMER_START_NS=$TIMER_START_NS" # echo "TIMER_END=$TIMER_END" # echo "TIMER_END_S=$TIMER_END_S" # echo "TIMER_END_NS=$TIMER_END_NS" TIMER_S=$(($TIMER_END_S-$TIMER_START_S)) # echo "TIMER_S=$TIMER_S" TIMER_END_NS="${TIMER_S}${TIMER_END_NS}" # echo "TIMER_END_NS=$TIMER_END_NS" TIMER_START_NS=$(trim_zeroes ${TIMER_START_NS}) TIMER_END_NS=$(trim_zeroes ${TIMER_END_NS}) # echo "TIMER_START_NS=$TIMER_START_NS" # echo "TIMER_END_NS=$TIMER_END_NS" TIMER_NS=$(( ${TIMER_END_NS} - ${TIMER_START_NS} )) # echo "TIMER_NS=$TIMER_NS" C=${BrightBlack:2:10} LAST_POST_RESULT=$(printf "${C}%10s " $(print_time $TIMER_NS)) TIMER_START="" } #trap 'stats_start' DEBUG #PROMPT_COMMAND=stats_stop GIT_PROMPT_THEME=Single_line_NoExitState_openSUSE GIT_PROMPT_SHOW_UPSTREAM= LAST_POST_RESULT=" " . ~/git/bash-git-prompt/gitprompt.sh export EDITOR=vim export LD_LIBRARY_PATH=/home/plasmahh/opt/radare2/lib/ export PATH=$PATH:/home/plasmahh/opt/radare2/bin/ #. ~/git/fuzzy_bash_completion/fuzzy_bash_completion #fuzzy_replace_filedir_xspec #fuzzy_setup_for_command cd #fuzzy_setup_for_command ls #fuzzy_setup_for_command l #fuzzy_setup_for_command ll #fuzzy_setup_for_command vim &>/dev/null #fuzzy_setup_for_command vi &>/dev/null #fuzzy_setup_for_command git [ -f ~/.fzf.bash ] && source ~/.fzf.bash export PREVIEWLINES=500 # GIT heart FZF # ------------- is_in_git_repo() { git rev-parse HEAD > /dev/null 2>&1 } fzf-down() { fzf --height 50% "$@" --border } gf() { is_in_git_repo || return git -c color.status=always status --short | fzf-down -m --ansi --nth 2..,.. \ --inline-info --bind page-up:preview-up,page-down:preview-down \ --preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' | cut -c4- | sed 's/.* -> //' } #--preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$PREVIEWLINES | gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | fzf-down --ansi --multi --tac --preview-window right:70% \ --inline-info --bind page-up:preview-up,page-down:preview-down \ --preview 'git lol $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$PREVIEWLINES | sed 's/^..//' | cut -d' ' -f1 | sed 's#^remotes/##' } gt() { is_in_git_repo || return git tag --sort -version:refname | fzf-down --multi --preview-window right:70% \ --inline-info --bind page-up:preview-up,page-down:preview-down \ --preview 'git show --color=always {} | head -'$PREVIEWLINES } #git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | gh() { is_in_git_repo || return git lola | fzf-down --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \ --header 'Press CTRL-S to toggle sort' \ --inline-info --bind page-up:preview-up,page-down:preview-down \ --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$PREVIEWLINES | grep -o "[a-f0-9]\{7,\}" } #--preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1} | head -'$PREVIEWLINES | gr() { is_in_git_repo || return git remote -v | awk '{print $1 "\t" $2}' | uniq | fzf-down --tac \ --inline-info --bind page-up:preview-up,page-down:preview-down \ --preview 'git lol {1} | head -'$PREVIEWLINES | cut -d$'\t' -f1 } bind '"\er": redraw-current-line' bind '"\C-g\C-f": "$(gf)\e\C-e\er"' bind '"\C-g\C-b": "$(gb)\e\C-e\er"' bind '"\C-g\C-t": "$(gt)\e\C-e\er"' bind '"\C-g\C-h": "$(gh)\e\C-e\er"' bind '"\C-g\C-r": "$(gr)\e\C-e\er"' bind "set menu-complete-display-prefix on" bind "set show-all-if-ambiguous on" bind 'TAB':menu-complete FZF_DEFAULT_OPTS="--inline-info --bind page-up:preview-up,page-down:preview-down --height=60% --preview '[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file: \$(file -L {}) || ( highlight -s breeze -O xterm256 -l {} || cat {} ) 2> /dev/null | head -'$PREVIEWLINES" . ~/git/mdps-tool-admreq-complete/AdmReq-complete.sh . ~/bin/xd-complete.sh