Commit 524532669599a5d9033e4ec53a2dbe1cc4b523f9
1 parent
88963b0bbb
Exists in
master
and in
2 other branches
bashrc.sh:
MOVE FROM templates TO dotfiles
Showing 2 changed files with 126 additions and 126 deletions Inline Diff
dotfiles/bashrc.sh
| File was created | 1 | #@IgnoreInspection AddShebang | |
| 2 | |||
| 3 | export ZCFG=$HOME/.config/zsh-config | ||
| 4 | |||
| 5 | # If not running interactively, don't do anything | ||
| 6 | case $- in | ||
| 7 | *i*) ;; | ||
| 8 | *) return;; | ||
| 9 | esac | ||
| 10 | |||
| 11 | ######################## | ||
| 12 | # ******************** # | ||
| 13 | # * * # | ||
| 14 | # * COMPLETION * # | ||
| 15 | # * * # | ||
| 16 | # ******************** # | ||
| 17 | ######################## | ||
| 18 | |||
| 19 | # enable bash completion in interactive shells | ||
| 20 | if [ -f /etc/bash_completion ]; then | ||
| 21 | . /etc/bash_completion | ||
| 22 | fi | ||
| 23 | |||
| 24 | # if the command-not-found package is installed, use it | ||
| 25 | if [ -x /usr/lib/command-not-found ]; then | ||
| 26 | function command_not_found_handle { | ||
| 27 | # check because c-n-f could've been removed in the meantime | ||
| 28 | if [ -x /usr/lib/command-not-found ]; then | ||
| 29 | /usr/bin/python /usr/lib/command-not-found -- $1 | ||
| 30 | return $? | ||
| 31 | else | ||
| 32 | return 127 | ||
| 33 | fi | ||
| 34 | } | ||
| 35 | fi | ||
| 36 | |||
| 37 | ######################## | ||
| 38 | # ******************** # | ||
| 39 | # * * # | ||
| 40 | # * HISTORY * # | ||
| 41 | # * * # | ||
| 42 | # ******************** # | ||
| 43 | ######################## | ||
| 44 | |||
| 45 | # Eternal bash history. | ||
| 46 | # --------------------- | ||
| 47 | export HISTFILESIZE= | ||
| 48 | export HISTSIZE= | ||
| 49 | export HISTTIMEFORMAT="[%F %T] " | ||
| 50 | # Change the file location | ||
| 51 | export HISTFILE=~/.config/new_bash_history | ||
| 52 | # Force prompt to write history after every command | ||
| 53 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | ||
| 54 | |||
| 55 | ######################## | ||
| 56 | # ******************** # | ||
| 57 | # * * # | ||
| 58 | # * MISC * # | ||
| 59 | # * * # | ||
| 60 | # ******************** # | ||
| 61 | ######################## | ||
| 62 | |||
| 63 | # check the window size after each command | ||
| 64 | shopt -s checkwinsize | ||
| 65 | |||
| 66 | # If set, the pattern "**" used in a pathname expansion context will | ||
| 67 | # match all files and zero or more directories and subdirectories. | ||
| 68 | #shopt -s globstar | ||
| 69 | |||
| 70 | # set variable identifying the chroot you work in (used in the prompt below) | ||
| 71 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | ||
| 72 | debian_chroot=$(cat /etc/debian_chroot) | ||
| 73 | fi | ||
| 74 | |||
| 75 | # set a fancy prompt | ||
| 76 | case "$TERM" in | ||
| 77 | xterm-color) color_prompt=yes;; | ||
| 78 | esac | ||
| 79 | |||
| 80 | # colored prompt | ||
| 81 | force_color_prompt=yes | ||
| 82 | |||
| 83 | if [ -n "$force_color_prompt" ]; then | ||
| 84 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||
| 85 | # We have color support; assume it's compliant with Ecma-48 | ||
| 86 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | ||
| 87 | # a case would tend to support setf rather than setaf.) | ||
| 88 | color_prompt=yes | ||
| 89 | else | ||
| 90 | color_prompt= | ||
| 91 | fi | ||
| 92 | fi | ||
| 93 | |||
| 94 | if [ "$color_prompt" = yes ]; then | ||
| 95 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | ||
| 96 | else | ||
| 97 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | ||
| 98 | fi | ||
| 99 | #unset color_prompt force_color_prompt | ||
| 100 | |||
| 101 | # enable color support of ls and also add handy aliases | ||
| 102 | if [ -x /usr/bin/dircolors ]; then | ||
| 103 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | ||
| 104 | alias ls='ls --color=auto' | ||
| 105 | alias dir='dir --color=auto' | ||
| 106 | alias vdir='vdir --color=auto' | ||
| 107 | |||
| 108 | alias grep='grep --color=auto' | ||
| 109 | alias fgrep='fgrep --color=auto' | ||
| 110 | alias egrep='egrep --color=auto' | ||
| 111 | fi | ||
| 112 | |||
| 113 | # Environment | ||
| 114 | if [ -f $ZCFG/dotfiles/environment.sh ]; then | ||
| 115 | . $ZCFG/dotfiles/environment.sh | ||
| 116 | fi | ||
| 117 | |||
| 118 | # Alias definitions | ||
| 119 | if [ -f $ZCFG/dotfiles/bash_aliases.sh ]; then | ||
| 120 | . $ZCFG/dotfiles/bash_aliases.sh | ||
| 121 | fi | ||
| 122 | |||
| 123 | # Start zsh if in OpenVZ CT | ||
| 124 | if [ -d /proc/vz ] && [ ! -d /proc/vz/beancounter ]; then | ||
| 125 | cd && zsh && exit | ||
| 126 | fi | ||
| 127 |
templates/bashrc.sh
| 1 | #@IgnoreInspection AddShebang | File was deleted | |
| 2 | |||
| 3 | export ZCFG=$HOME/.config/zsh-config | ||
| 4 | |||
| 5 | # If not running interactively, don't do anything | ||
| 6 | case $- in | ||
| 7 | *i*) ;; | ||
| 8 | *) return;; | ||
| 9 | esac | ||
| 10 | |||
| 11 | ######################## | ||
| 12 | # ******************** # | ||
| 13 | # * * # | ||
| 14 | # * COMPLETION * # | ||
| 15 | # * * # | ||
| 16 | # ******************** # | ||
| 17 | ######################## | ||
| 18 | |||
| 19 | # enable bash completion in interactive shells | ||
| 20 | if [ -f /etc/bash_completion ]; then | ||
| 21 | . /etc/bash_completion | ||
| 22 | fi | ||
| 23 | |||
| 24 | # if the command-not-found package is installed, use it | ||
| 25 | if [ -x /usr/lib/command-not-found ]; then | ||
| 26 | function command_not_found_handle { | ||
| 27 | # check because c-n-f could've been removed in the meantime | ||
| 28 | if [ -x /usr/lib/command-not-found ]; then | ||
| 29 | /usr/bin/python /usr/lib/command-not-found -- $1 | ||
| 30 | return $? | ||
| 31 | else | ||
| 32 | return 127 | ||
| 33 | fi | ||
| 34 | } | ||
| 35 | fi | ||
| 36 | |||
| 37 | ######################## | ||
| 38 | # ******************** # | ||
| 39 | # * * # | ||
| 40 | # * HISTORY * # | ||
| 41 | # * * # | ||
| 42 | # ******************** # | ||
| 43 | ######################## | ||
| 44 | |||
| 45 | # Eternal bash history. | ||
| 46 | # --------------------- | ||
| 47 | export HISTFILESIZE= | ||
| 48 | export HISTSIZE= | ||
| 49 | export HISTTIMEFORMAT="[%F %T] " | ||
| 50 | # Change the file location | ||
| 51 | export HISTFILE=~/.config/new_bash_history | ||
| 52 | # Force prompt to write history after every command | ||
| 53 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | ||
| 54 | |||
| 55 | ######################## | ||
| 56 | # ******************** # | ||
| 57 | # * * # | ||
| 58 | # * MISC * # | ||
| 59 | # * * # | ||
| 60 | # ******************** # | ||
| 61 | ######################## | ||
| 62 | |||
| 63 | # check the window size after each command | ||
| 64 | shopt -s checkwinsize | ||
| 65 | |||
| 66 | # If set, the pattern "**" used in a pathname expansion context will | ||
| 67 | # match all files and zero or more directories and subdirectories. | ||
| 68 | #shopt -s globstar | ||
| 69 | |||
| 70 | # set variable identifying the chroot you work in (used in the prompt below) | ||
| 71 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | ||
| 72 | debian_chroot=$(cat /etc/debian_chroot) | ||
| 73 | fi | ||
| 74 | |||
| 75 | # set a fancy prompt | ||
| 76 | case "$TERM" in | ||
| 77 | xterm-color) color_prompt=yes;; | ||
| 78 | esac | ||
| 79 | |||
| 80 | # colored prompt | ||
| 81 | force_color_prompt=yes | ||
| 82 | |||
| 83 | if [ -n "$force_color_prompt" ]; then | ||
| 84 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||
| 85 | # We have color support; assume it's compliant with Ecma-48 | ||
| 86 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | ||
| 87 | # a case would tend to support setf rather than setaf.) | ||
| 88 | color_prompt=yes | ||
| 89 | else | ||
| 90 | color_prompt= | ||
| 91 | fi | ||
| 92 | fi | ||
| 93 | |||
| 94 | if [ "$color_prompt" = yes ]; then | ||
| 95 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | ||
| 96 | else | ||
| 97 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | ||
| 98 | fi | ||
| 99 | #unset color_prompt force_color_prompt | ||
| 100 | |||
| 101 | # enable color support of ls and also add handy aliases | ||
| 102 | if [ -x /usr/bin/dircolors ]; then | ||
| 103 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | ||
| 104 | alias ls='ls --color=auto' | ||
| 105 | alias dir='dir --color=auto' | ||
| 106 | alias vdir='vdir --color=auto' | ||
| 107 | |||
| 108 | alias grep='grep --color=auto' | ||
| 109 | alias fgrep='fgrep --color=auto' | ||
| 110 | alias egrep='egrep --color=auto' | ||
| 111 | fi | ||
| 112 | |||
| 113 | # Environment | ||
| 114 | if [ -f $ZCFG/dotfiles/environment.sh ]; then | ||
| 115 | . $ZCFG/dotfiles/environment.sh | ||
| 116 | fi | ||
| 117 | |||
| 118 | # Alias definitions | ||
| 119 | if [ -f $ZCFG/templates/bash_aliases.sh ]; then | ||
| 120 | . $ZCFG/templates/bash_aliases.sh | ||
| 121 | fi | ||
| 122 | |||
| 123 | # Start zsh if in OpenVZ CT | ||
| 124 | if [ -d /proc/vz ] && [ ! -d /proc/vz/beancounter ]; then | ||
| 125 | cd && zsh && exit | ||
| 126 | fi | ||
| 127 | 1 | #@IgnoreInspection AddShebang |