Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ~/.bashrc -- yunga.palatino@gmail.com
- umask 002
- ### Non-interactive shell stops here
- [[ $- != *i* ]] && return;
- WARNINGS=0
- ### Locales
- unset -v LC_ALL
- export LANG="en_US.utf-8" # All locale settings at once, customization in LC_* below
- export LC_COLLATE="C.utf-8" # Define alphabetical ordering of strings.
- export LC_CTYPE="fr_FR.utf-8" # Determines which characters are seen as part of alphabet, numeric and so on. This also determines the character set used, if applicable.
- export LC_MESSAGES="C.utf-8" # Program localizations
- export LC_TIME="POSIX" # Time format
- ### Temporay files directory
- export TMP="$HOME/tmp" # Temporary directory
- export TEMP="$TMP" # for dos/win apps
- export TMPDIR="$TMP" # Unix
- if [[ ! -d $TMP ]]; then # xxx maybe create the temp dir?
- echo bashrc: Something is wrong with your TMP dir: "$TMP".
- unset -v TMP TEMP TMPDIR
- fi
- ### Bash Options
- #export TMOUT=300 # Exit bash after 5 minutes (for remote users)
- export IGNOREEOF=1 # CTRL-D twice to exit
- export CDPATH=".:~/.cdpath" # Path to search when cd'ing
- export TIMEFORMAT=$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS\ncpu%%\t%P' # Output format for the time builtin
- # History settings:
- export HISTFILESIZE=4096 # Number of line to save
- export HISTSIZE=1024 # Number of command to remember
- export HISTCONTROL="ignoreboth" # dont save already entered commands, and command starting with a space (same as ignoredups:ignorespace)
- export PROMPT_COMMAND='history -a' # Save history everytime you issue a command, useful when multiple bash are running in screen (see shopt -s histappend)
- ### Editor
- export EDITOR="vim"
- export VISUAL=$EDITOR # screen oriented editor (as opposed to ed)
- export FCEDIT=$EDITOR # edit command with vim
- ### Pager
- unset -v LESSCHARSET # Fix manpages looking funky
- export PAGER='less'
- export LESS='-iMnQRSw -PM[%i/%m\: ?f%f:STDIN.] [C\:%c] [L\:?l%l:*.-?lb%lb:*./?L%L:*.] [P\:?d%d:*./?D%D:*.] [O\:?b%b:*./?B%B:*.] [?pt%pt:*.-?Pb%Pb:*.\%]'
- export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green
- export LESS_TERMCAP_md=$(tput bold; tput setaf 6) # cyan
- export LESS_TERMCAP_me=$(tput sgr0)
- export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) # yellow on blue
- export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
- export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7) # white
- export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
- export LESS_TERMCAP_mr=$(tput rev)
- export LESS_TERMCAP_mh=$(tput dim)
- export LESS_TERMCAP_ZN=$(tput ssubm)
- export LESS_TERMCAP_ZV=$(tput rsubm)
- export LESS_TERMCAP_ZO=$(tput ssupm)
- export LESS_TERMCAP_ZW=$(tput rsupm)
- [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
- ### Various
- export GREP_COLOR=31
- #export LYNX_CFG="~/.lynx/lynx.cfg"
- export SCREENRC="$HOME/.screenrc"
- eval "$(dircolors .dircolors)"
- ### Command line option/completion
- export FIGNORE='.bck:.bak:.sav:~' # ignored ext for completion
- if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
- fi
- ### if the command-not-found package is installed, use it
- if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found ]; then
- function command_not_found_handle {
- # check because c-n-f could've been removed in the meantime
- if [ -x /usr/lib/command-not-found ]; then
- /usr/bin/python /usr/lib/command-not-found -- $1
- return $?
- elif [ -x /usr/share/command-not-found ]; then
- /usr/bin/python /usr/share/command-not-found -- $1
- return $?
- else
- return 127
- fi
- }
- fi
- ### Setting PATH:
- export PATH="~/bin/:$PATH"
- #unset -v PATH
- #line=1
- #while read -r path; do
- # path=${path%#*}
- # path=${path##*([$' \t\n'])}
- # path=${path%%*([$' \t\n'])}
- # eval "path=\"$path\""
- #
- # if [[ $path ]]; then
- # if [[ -d "$path" && -r "$path" ]]; then
- # PATH="$PATH:$path"
- # else
- # [ $WARNINGS == 1 ] && echo Discarded "$path" at line $line from your PATH.
- # fi
- # fi
- #
- # let line=line+1
- #done < ~/.bash/path.txt
- #
- #unset -v line path
- #export PATH
- ### Load shell options, aliases, functions, and host configurations file.
- # ATTN: All previously defined aliases will be removed!
- for file in ~/.bash/shell_options.sh ~/.bash/aliases_functions.sh ~/.bash/hosts/$HOSTNAME_*.sh; do
- if [[ -f $file && -r $file ]]; then
- . $file
- else
- [ $WARNINGS == 1 ] && echo bashrc: there is an problem with "$file".
- fi
- done
- unset -v file
- ### Prompt
- # Old: PS1="\n\033[93;44m\n\033[93;92mDate: \033[93;44m\d, \t \033[0;92m\nUser: \033[0;97m[\033[0;93m\u\033[0;97m@\033[0;93m\H\033[0;97m] \033[0;92mJobs: \033[0;97m[\033[0;93m\j\033[0;97m]\033[0;92m History: \033[0;97m[\033[0;93m\!\033[0;97m]\033[0;39m\n\033[0;93m\w\033[0;97m\$\033[0;39m "
- PS1='\n\[\017\]\033[33;`if [ $? = 0 ]; then echo "44"; else echo "41"; fi`;1m\n# \D{%F %T} \033[32mU:\033[37m[\033[33m\u\033[37m@\033[33m\H\033[37m] \033[32mJ:\033[37m[\033[33m\j\033[37m] \033[32mH:\033[37m[\033[33m\#/\!\033[37m]\033[33;40;1m\n# \w\033[37m\$\[\033[0m\]\n'
- PS2='\033[0;91m> \033[0;39m'
- ### Keyboard, bell, display style: the readline config file:
- export INPUTRC="$HOME/.inputrc" # process my readline settings
- bind -f ~/.inputrc
- ### Function keys (use ctrl-v key at prompt to know the assigned string, it's a hack)
- # here we assign
- bind '"\eOP":"\201"'; bind -x '"\201":"aliasinfo"' # F1: Aliases help
- bind '"\e[23~":"\212"'; bind -x '"\212":"cliref"' # S-F1: Unix CLI Reference
- bind '"\eOQ":"\202"'; bind -x '"\202":"ncal -y | less"' # F2: Display Calendar
- bind '"\eOR":"\203"'; bind -x '"\203":"psaux -p$USER"' # F3: List Processes
- bind '"\eOS":"\204"'; bind -x '"\204":"$EDITOR ."' # F4: Editor
- bind '"\e[20~":"\209"'; bind -x '"\209":"htop"' # F8: Htop
- bind '"\e[21~":"\210"'; bind -x '"\210":"mc"' # F10: Midnight Commander
- ### Perl local::lib, touch ~/.perlib to enable this
- if [[ -f ~/.perlocalib ]]; then
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- fi
- ### Clean
- unset -v WARNINGS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement