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