fhumayun

Cool Bash Prompt

Apr 19th, 2015
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. green='\e[0;32m'
  2. GREEN='\e[0;32m'
  3. red='\e[0;31m'
  4. RED='\e[1;31m'
  5. blue='\e[0;34m'
  6. BLUE='\e[1;34m'
  7. cyan='\e[0;36m'
  8. CYAN='\e[1;36m'
  9. NC='\e[0m'
  10.  
  11. [ -z "$PS1" ] && return
  12. HISTCONTROL=ignoredups:ignorespace
  13. shopt -s histappend
  14. HISTSIZE=1000
  15. HISTFILESIZE=2000
  16. shopt -s checkwinsize
  17. complete -cf sudo
  18. PROMPT_COMMAND='history -a'
  19. shopt -s cdspell
  20. shopt -s dirspell
  21.  
  22. export EDITOR=vim
  23. TERM=xterm                          # лечим баг с тмуксом (ломает хоткеи прог, считая что это скрины)
  24.  
  25. #---{функция, запускающаяся при выходе из оболочки}---
  26. function _exit()
  27. {
  28.     echo -e "${CYAN}Bye, master :)${NC}"
  29. }
  30. trap _exit EXIT
  31. #-----------------------------------------------------
  32.  
  33. clear
  34.  
  35. # make less more friendly for non-text input files, see lesspipe(1)
  36. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  37.  
  38. # set variable identifying the chroot you work in (used in the prompt below)
  39. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  40.     debian_chroot=$(cat /etc/debian_chroot)
  41. fi
  42.  
  43. # set a fancy prompt (non-color, unless we know we "want" color)
  44. case "$TERM" in
  45.     xterm-color) color_prompt=yes;;
  46. esac
  47.  
  48. [ -n "$SSH_CLIENT" ] && ps1_informer=" ${BLUE}[ssh]${NC}"
  49. [ -n "$RANGER_LEVEL" ] && ps1_informer=" (in ranger)"
  50.  
  51. if [ $(id -u) -eq 0 ];
  52. then
  53.   PS1="┌${RED}[\u]${NC} [\h]$ps1_informer:\[\e[0;32;49m\]\w\[\e[0m \n└>"
  54. else
  55.   PS1="┌[${GREEN}\u${NC}] [\h]$ps1_informer:\[\e[0;32;49m\]\w\[\e[0m \n└>"
  56. fi
  57.  
  58. # Add an "alert" alias for long running commands.  Use like so:
  59. #   sleep 10; alert
  60. alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//     '\'')"'
  61.  
  62. # Alias definitions.
  63. # You may want to put all your additions into a separate file like
  64. # ~/.bash_aliases, instead of adding them here directly.
  65. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  66.  
  67. if [ -f ~/.bash_aliases ]; then
  68.     . ~/.bash_aliases
  69. fi
  70.  
  71. # enable programmable completion features (you don't need to enable
  72. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  73. # sources /etc/bash.bashrc).
  74. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  75.     . /etc/bash_completion
  76. fi
  77.  
  78. # internal func alias list ---------------
  79. alias un="unarchive $1"
  80. alias re="renamer"
  81. alias c="ssh_choose"
  82. #-----------------------------------------
  83.  
  84. alias r='ranger'
  85. alias p='ps ax | grep -v grep | grep -i'
  86. alias ub='source ~/.bashrc'
  87. alias ip='curl ifconfig.me'
  88.  
  89. #-work-------
  90. alias m='sudo mount -t cifs -o guest //192.168.233.10/pub /home/lord/GEKTOR'
  91. alias x='/home/lord/work'
  92. alias z='/home/lord/cisco'
  93. #------------
  94.  
  95. #-progs mod--
  96. alias tmux='tmux attach || tmux new'
  97. alias mtr='mtr -gtk'
  98. alias b-sync='/home/lord/.b-sync/master.sh'
  99. alias grep='grep --color=auto'
  100. alias fgrep='fgrep --color=auto'
  101. alias egrep='egrep --color=auto'
  102. alias ls='ls --color=auto'
  103. #------------
  104.  
  105. alias lvim='vim -u /home/lord/.lvim/vimrc'
  106.  
  107. PATH=$PATH:$HOME/.rvm/bin
Add Comment
Please, Sign In to add comment