dartokloning revised this gist . Go to revision
1 file changed, 236 insertions
.bashrc(file created)
| @@ -0,0 +1,236 @@ | |||
| 1 | + | # ~/.bashrc: executed by bash(1) for non-login shells. | |
| 2 | + | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| 3 | + | # for examples | |
| 4 | + | ||
| 5 | + | # If not running interactively, don't do anything | |
| 6 | + | case $- in | |
| 7 | + | *i*) ;; | |
| 8 | + | *) return;; | |
| 9 | + | esac | |
| 10 | + | ||
| 11 | + | # don't put duplicate lines or lines starting with space in the history. | |
| 12 | + | # See bash(1) for more options | |
| 13 | + | HISTCONTROL=ignoreboth:erasedups | |
| 14 | + | ||
| 15 | + | # append to the history file, don't overwrite it | |
| 16 | + | shopt -s histappend cmdhist lithist | |
| 17 | + | ||
| 18 | + | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
| 19 | + | HISTSIZE=100000 | |
| 20 | + | HISTFILESIZE=500000 | |
| 21 | + | ||
| 22 | + | # check the window size after each command and, if necessary, | |
| 23 | + | # update the values of LINES and COLUMNS. | |
| 24 | + | shopt -s checkwinsize | |
| 25 | + | ||
| 26 | + | # If set, the pattern "**" used in a pathname expansion context will | |
| 27 | + | # match all files and zero or more directories and subdirectories. | |
| 28 | + | #shopt -s globstar | |
| 29 | + | ||
| 30 | + | blue="\033[0;34m" | |
| 31 | + | nocolor="\033[0m" | |
| 32 | + | ||
| 33 | + | day=$(date +%A) | |
| 34 | + | case $day in | |
| 35 | + | Monday) | |
| 36 | + | hari="Senin" | |
| 37 | + | ;; | |
| 38 | + | Tuesday) | |
| 39 | + | hari="Selasa" | |
| 40 | + | ;; | |
| 41 | + | Wednesday) | |
| 42 | + | hari="Rabu" | |
| 43 | + | ;; | |
| 44 | + | Thursday) | |
| 45 | + | hari="Kamis" | |
| 46 | + | ;; | |
| 47 | + | Friday) | |
| 48 | + | hari="Jum'at" | |
| 49 | + | ;; | |
| 50 | + | Saturday) | |
| 51 | + | hari="Sabtu" | |
| 52 | + | ;; | |
| 53 | + | Sunday) | |
| 54 | + | hari="Ahad" | |
| 55 | + | ;; | |
| 56 | + | *) | |
| 57 | + | hari="Tidak diketahui" | |
| 58 | + | ;; | |
| 59 | + | esac | |
| 60 | + | ||
| 61 | + | month=$(date +%B) | |
| 62 | + | case $month in | |
| 63 | + | January) | |
| 64 | + | bulan="Januari" | |
| 65 | + | ;; | |
| 66 | + | February) | |
| 67 | + | bulan="Februari" | |
| 68 | + | ;; | |
| 69 | + | March) | |
| 70 | + | bulan="Maret" | |
| 71 | + | ;; | |
| 72 | + | April) | |
| 73 | + | bulan="April" | |
| 74 | + | ;; | |
| 75 | + | May) | |
| 76 | + | bulan="Mei" | |
| 77 | + | ;; | |
| 78 | + | June) | |
| 79 | + | bulan="Juni" | |
| 80 | + | ;; | |
| 81 | + | July) | |
| 82 | + | bulan="Juli" | |
| 83 | + | ;; | |
| 84 | + | August) | |
| 85 | + | bulan="Agustus" | |
| 86 | + | ;; | |
| 87 | + | September) | |
| 88 | + | bulan="September" | |
| 89 | + | ;; | |
| 90 | + | October) | |
| 91 | + | bulan="Oktober" | |
| 92 | + | ;; | |
| 93 | + | November) | |
| 94 | + | bulan="November" | |
| 95 | + | ;; | |
| 96 | + | December) | |
| 97 | + | bulan="Desember" | |
| 98 | + | ;; | |
| 99 | + | *) | |
| 100 | + | bulan="Tidak diketahui" | |
| 101 | + | ;; | |
| 102 | + | esac | |
| 103 | + | ||
| 104 | + | #PS1='\[\e[38;5;160m\][\[\e[38;5;39m\]\D{%A, %d %B %Y}\[\e[0;1m\] - \[\e[38;5;184m\]\t\[\e[0;38;5;160m\]]\[\e[0m\]' | |
| 105 | + | ||
| 106 | + | #HISTTIMEFORMAT=`echo -e ${blue}[${hari}, %d ${bulan} %Y - %T] $nocolor ` | |
| 107 | + | HISTTIMEFORMAT=`echo -e "\e[38;5;160m[\e[38;5;39m${hari}, %d ${bulan} %Y \e[0;1m - \e[38;5;184m %T\e[0;38;5;160m]\e[0m " ` | |
| 108 | + | HISTIGNORE="ls:ll:pwd:bg:fg:history:tree" | |
| 109 | + | ||
| 110 | + | # make less more friendly for non-text input files, see lesspipe(1) | |
| 111 | + | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
| 112 | + | ||
| 113 | + | # set variable identifying the chroot you work in (used in the prompt below) | |
| 114 | + | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
| 115 | + | debian_chroot=$(cat /etc/debian_chroot) | |
| 116 | + | fi | |
| 117 | + | ||
| 118 | + | # set a fancy prompt (non-color, unless we know we "want" color) | |
| 119 | + | case "$TERM" in | |
| 120 | + | xterm-color|*-256color) color_prompt=yes;; | |
| 121 | + | esac | |
| 122 | + | ||
| 123 | + | # uncomment for a colored prompt, if the terminal has the capability; turned | |
| 124 | + | # off by default to not distract the user: the focus in a terminal window | |
| 125 | + | # should be on the output of commands, not on the prompt | |
| 126 | + | #force_color_prompt=yes | |
| 127 | + | ||
| 128 | + | if [ -n "$force_color_prompt" ]; then | |
| 129 | + | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
| 130 | + | # We have color support; assume it's compliant with Ecma-48 | |
| 131 | + | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
| 132 | + | # a case would tend to support setf rather than setaf.) | |
| 133 | + | color_prompt=yes | |
| 134 | + | else | |
| 135 | + | color_prompt= | |
| 136 | + | fi | |
| 137 | + | fi | |
| 138 | + | ||
| 139 | + | if [ "$color_prompt" = yes ]; then | |
| 140 | + | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
| 141 | + | else | |
| 142 | + | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
| 143 | + | fi | |
| 144 | + | unset color_prompt force_color_prompt | |
| 145 | + | ||
| 146 | + | # If this is an xterm set the title to user@host:dir | |
| 147 | + | case "$TERM" in | |
| 148 | + | xterm*|rxvt*) | |
| 149 | + | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |
| 150 | + | ;; | |
| 151 | + | *) | |
| 152 | + | ;; | |
| 153 | + | esac | |
| 154 | + | ||
| 155 | + | # enable color support of ls and also add handy aliases | |
| 156 | + | if [ -x /usr/bin/dircolors ]; then | |
| 157 | + | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
| 158 | + | alias ls='ls -lah --color=auto' | |
| 159 | + | #alias dir='dir --color=auto' | |
| 160 | + | #alias vdir='vdir --color=auto' | |
| 161 | + | ||
| 162 | + | #alias grep='grep --color=auto' | |
| 163 | + | #alias fgrep='fgrep --color=auto' | |
| 164 | + | #alias egrep='egrep --color=auto' | |
| 165 | + | fi | |
| 166 | + | ||
| 167 | + | # colored GCC warnings and errors | |
| 168 | + | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | |
| 169 | + | ||
| 170 | + | # some more ls aliases | |
| 171 | + | #alias ll='ls -l' | |
| 172 | + | #alias la='ls -A' | |
| 173 | + | #alias l='ls -CF' | |
| 174 | + | alias sudo="sudo " | |
| 175 | + | alias ls="ls -lah --color=auto" | |
| 176 | + | alias treeall="tree -ugsh --du" | |
| 177 | + | ||
| 178 | + | # Alias definitions. | |
| 179 | + | # You may want to put all your additions into a separate file like | |
| 180 | + | # ~/.bash_aliases, instead of adding them here directly. | |
| 181 | + | # See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
| 182 | + | ||
| 183 | + | if [ -f ~/.bash_aliases ]; then | |
| 184 | + | . ~/.bash_aliases | |
| 185 | + | fi | |
| 186 | + | ||
| 187 | + | # enable programmable completion features (you don't need to enable | |
| 188 | + | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
| 189 | + | # sources /etc/bash.bashrc). | |
| 190 | + | if ! shopt -oq posix; then | |
| 191 | + | if [ -f /usr/share/bash-completion/bash_completion ]; then | |
| 192 | + | . /usr/share/bash-completion/bash_completion | |
| 193 | + | elif [ -f /etc/bash_completion ]; then | |
| 194 | + | . /etc/bash_completion | |
| 195 | + | fi | |
| 196 | + | fi | |
| 197 | + | ||
| 198 | + | ##----------------------------------------------------- | |
| 199 | + | ## synth-shell-prompt.sh | |
| 200 | + | if [ -f /home/$USER/.config/shell-prompt.sh ] && [ -n "$( echo $- | grep i )" ]; then | |
| 201 | + | source /home/$USER/.config/shell-prompt.sh | |
| 202 | + | else | |
| 203 | + | wget https://gist.darto.id/dartokloning/def50cb1b3024c3b8683960c873caf34/download/HEAD/shell-prompt.sh -P /home/$USER/.config | |
| 204 | + | source /home/$USER/.config/shell-prompt.sh | |
| 205 | + | fi | |
| 206 | + | ||
| 207 | + | if [ -f /usr/bin/vivid ]; then | |
| 208 | + | #export LS_COLORS="$(vivid generate snazzy)" | |
| 209 | + | ||
| 210 | + | ##--------------------------------------------------------- | |
| 211 | + | ## change LS_COLORS with random theme generated by vivid | |
| 212 | + | ##--------------------------------------------------------- | |
| 213 | + | ||
| 214 | + | # Define the list of items | |
| 215 | + | themes=("alabaster_dark" "ayu" "catppuccin-frappe" "catppuccin-latte" "dracula" "iceberg-dark" "jellybeans" "lava" "molokai" "nord" "one-dark" "one-light" "rose-pine" "rose-pine-dawn" "snazzy" "solarized-dark" "tokyonight-moon" "zenburn") | |
| 216 | + | ||
| 217 | + | # Get the current date in YYYYMMDD format | |
| 218 | + | current_date=$(date +%Y%m%d) | |
| 219 | + | ||
| 220 | + | # Use the date as a seed for the random number generator | |
| 221 | + | RANDOM=$current_date | |
| 222 | + | ||
| 223 | + | # Get a random index based on the number of items | |
| 224 | + | random_index=$((RANDOM % ${#themes[@]})) | |
| 225 | + | theme_now=${themes[$random_index]} | |
| 226 | + | ||
| 227 | + | export LS_COLORS="$(vivid generate $theme_now)" | |
| 228 | + | ||
| 229 | + | else | |
| 230 | + | ||
| 231 | + | wget https://github.com/sharkdp/vivid/releases/download/v0.10.1/vivid_0.10.1_amd64.deb | |
| 232 | + | sudo dpkg -i vivid_0.10.1_amd64.deb | |
| 233 | + | rm vivid_0.10.1_amd64.deb | |
| 234 | + | source /home/$USER/.bashrc | |
| 235 | + | ||
| 236 | + | fi | |
Newer
Older