The aptly named.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.8 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. export EDITOR=vim
  2. set -o vi
  3. # If not running interactively, don't do anything
  4. [ -z "$PS1" ] && return
  5. # Get our git stuff
  6. source ~/code/dotfiles/git-completion.sh
  7. source ~/code/dotfiles/git-prompt.sh
  8. export PROMPT_DIRTRIM=2
  9. # Prompt colors
  10. BGREEN='\[\033[1;32m\]'
  11. GREEN='\[\033[0;32m\]'
  12. BRED='\[\033[1;31m\]'
  13. BPURPLE='\e[1;36m'
  14. PURPLE='\e[0;36m'
  15. RED='\[\033[0;31m\]'
  16. CYAN='\[\033[0;36m\]'
  17. LCYAN='\[\033[1;36m\]'
  18. BBLUE='\[\033[1;34m\]'
  19. BLUE='\[\033[0;34m\]'
  20. GREY='\[033[0;37m\]'
  21. DGREY='\[033[1;30m\]'
  22. NORMAL='\[\033[00m\]'
  23. # Prompt vars
  24. TIME="\@"
  25. HOST="\h"
  26. CWD="\w"
  27. PUID="\$"
  28. GIT="\$(__git_ps1)"
  29. # Prompt display line
  30. PS1="${BLUE}(${GREEN}${CWD}${BLUE}) ${NORMAL}${HOST}${BRED}${GIT}${NORMAL} [$?${NORMAL}]${GREEN} ${PUID}${NORMAL} "
  31. # Set VI mode display in prompt
  32. bind "set vi-cmd-mode-string \"\1\e[1;30m\2:\1\e[0m\2\""
  33. bind "set vi-ins-mode-string \"\1\e[0;36m\2+\1\e[0m\2\""
  34. bind "set show-mode-in-prompt on"
  35. alias ls='ls -G'
  36. #mah aliases, son
  37. alias atr0phy='ssh -D 3333 -C br4n@atr0phy.net'
  38. alias at0rphy='ssh -L 9050:127.0.0.1:9050 br4n@atr0phy.net'
  39. alias evoluent='xinput --set-button-map 14 3 1 1 4 5 7 8 9 0 10 11'
  40. alias cls='clear && ls'
  41. alias notes="vim +VimwikiIndex"
  42. alias tmpvim="vim /tmp/$(uuid)"
  43. alias snip="scrot -s ~/Documents/screenshots/%b%d-%H:%M.png"
  44. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  45. . /etc/bash_completion
  46. fi
  47. # add this configuration to ~/.bashrc
  48. export HH_CONFIG=hicolor # get more colors
  49. shopt -s histappend # append new history items to .bash_history
  50. export HISTCONTROL=ignorespace # leading space hides commands from history
  51. export HISTFILESIZE=10000 # increase history file size (default is 500)
  52. export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
  53. export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" # mem/file sync
  54. # if this is interactive shell, then bind hh to Ctrl-r
  55. bind '"\C-r": "hh\n"'
  56. export NVM_DIR="/home/brandon.cornejo/.nvm"
  57. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
  58. # Clipboard jazz
  59. # A shortcut function that simplifies usage of xclip.
  60. # - Accepts input from either stdin (pipe), or params.
  61. # ------------------------------------------------
  62. cb() {
  63. local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m'
  64. # Check that xclip is installed.
  65. if ! type xclip > /dev/null 2>&1; then
  66. echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m"
  67. # Check user is not root (root doesn't have access to user xorg server)
  68. elif [[ "$USER" == "root" ]]; then
  69. echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m"
  70. else
  71. # If no tty, data should be available on stdin
  72. if ! [[ "$( tty )" == /dev/* ]]; then
  73. input="$(< /dev/stdin)"
  74. # Else, fetch input from params
  75. else
  76. input="$*"
  77. fi
  78. if [ -z "$input" ]; then # If no input, print usage message.
  79. echo "Copies a string to the clipboard."
  80. echo "Usage: cb <string>"
  81. echo " echo <string> | cb"
  82. else
  83. # Copy input to clipboard
  84. echo -n "$input" | xclip -selection c
  85. # Truncate text for status
  86. if [ ${#input} -gt 80 ]; then input="$(echo $input | cut -c1-80)$_trn_col...\e[0m"; fi
  87. # Print status.
  88. echo -e "$_scs_col""Copied to clipboard:\e[0m $input"
  89. fi
  90. fi
  91. }
  92. # Aliases / functions leveraging the cb() function
  93. # ------------------------------------------------
  94. # Copy contents of a file
  95. function cbf() { cat "$1" | cb; }
  96. # Copy SSH public key
  97. alias cbssh="cbf ~/.ssh/id_rsa.pub"
  98. # Copy current working directory
  99. alias cbwd="pwd | cb"
  100. # Copy most recent command in bash history
  101. alias cbhs="cat $HISTFILE | tail -n 1 | cb"
  102. # ASCII ART GOODNESS
  103. echo -e "$(<~/.motd)"
  104. # Search command history
  105. bind '"\e[A": history-search-backward'
  106. bind '"\e[B": history-search-forward'