blob: 03e1d31d3e6d3927bcefb00912caa812b7656de0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#
# ~/.bashrc: executed by bash(1) for interactive shells
#
# Tinkerer's guide to a prettier and colorful CLI:
# https://wiki.archlinux.org/title/Color_output_in_console
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Bash configuration
# ==================
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS. (Isn't this the default behaviour?)
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Alias definitions.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Don't forget to install bash-completion
# Prompt
# ------
# - Basic [user@host $pwd]$
#PS1='[\u@\h \W]\$ '
# - Blue timestamp and italic green pwd
#PS1='\[\033[34m\]|\D{%H:%M:%S}| \[\033[3;32m\][\w]\[\033[00m\]\n\$ '
# - user@host pwd (git prompt)
# Ref.: https://stackoverflow.com/a/15398153/7498073
source ~/mahcode/dotfiles/git/git-prompt.sh
PS1='\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
# Environment
# ===========
export EDITOR=nvim
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/mahcode/bin:$PATH"
# XDG = Cross-Desktop Group
# For more info see https://wiki.archlinux.org/index.php/XDG_Base_Directory
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export LC_COLLATE=C
# less
LESS="-i " # ignore case
LESS+="-S " # don't chop long lines
LESS+="--RAW-CONTROL-CHARS"
export LESS
# Extra programs
# --------------
# tldr
[ -f /usr/bin/tldr ] && export TLDR_CONFIG_DIR="$XDG_CONFIG_HOME"
# gpg
#export GPG_TTY=$(tty)
# tmux
#export TERM="xterm-256color"
# nvm
#source /usr/share/nvm/init-nvm.sh
# Pandoc: Bash completition for pandoc
if [ -f /usr/bin/pandoc ]; then
eval "$(pandoc --bash-completion)"
fi
# Homebrew (linuxbrew)
if [ -f /usr/bin/brew ]; then
# for elf executables
export PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"
# for manpages
export MANPATH="/home/linuxbrew/.linuxbrew/share/man:${MANPATH}"
# for info pages
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH}"
fi
# Node.js
#export NODE_PATH=~/code/nodejs/node-v16.15.1-linux-x64/lib/node_modules
# Rust
#. "$HOME/.cargo/env"
# Ruby on Rails
#https://stackoverflow.com/a/19072136/7498073
#gempath="$HOME/.local/share/gem/ruby/3.0.0/bin"
#export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
#if [[ -d $gempath ]]; then
# export PATH="$PATH:$GEM_HOME/bin"
#fi
# Fun
# ===
# Greeting or salute
if [ -f /usr/games/cowsay ] || [ -f /usr/bin/cowsay ]; then
#cowsay -f flaming-sheep "oh no" # original
#cowsay $(fortune -e 30% debian-hints 20% linux 20% science \
#cowsay $(fortune 30% debian-hints 20% linux 20% science \
# 20% off/linux 10% off/black-humor)
cowsay $(fortune)
#fortune ascii-art
else
echo "Welcome back $LOGNAME"
fi
|