summaryrefslogtreecommitdiffstats
path: root/bash
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2023-03-20 02:12:27 -0500
committerMitsuo Tokumori <[email protected]>2023-03-20 02:12:27 -0500
commit11aedecab8a8ef7d54f0fa2f1adc67ac78ba42eb (patch)
tree5df140f00fb12508310699af04bebde17a7d4117 /bash
parent3d4887349318f43dadf1de00ad15e35ba7812a84 (diff)
downloaddotfiles-11aedecab8a8ef7d54f0fa2f1adc67ac78ba42eb.tar.gz
dotfiles-11aedecab8a8ef7d54f0fa2f1adc67ac78ba42eb.tar.bz2
dotfiles-11aedecab8a8ef7d54f0fa2f1adc67ac78ba42eb.zip
Simplify bashrc, modify install.sh, add nvim/
bashrc is now simpler. Hopefully with the same functionality. Remove some of the default stuff that came with Debian years ago. Start with default Archlinux bashrc as base (very minimal). install.sh now recommends only using slinks. nvim and zathura now get linked directory-wise. This is way better because added configuration files will get here seamlessly. Doing diffs between 2 independent copies is painful. Now I'm transitioning to NeoVim. I've copied all relevant config from vimrc (Vim) to init.vim (NeoVim). Very promising. File got smaller and more organized in my opinion. PD: Cheers, this pulse15 laptop is amazing.
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_profile5
-rw-r--r--bash/bashrc131
2 files changed, 60 insertions, 76 deletions
diff --git a/bash/bash_profile b/bash/bash_profile
new file mode 100644
index 0000000..5545f00
--- /dev/null
+++ b/bash/bash_profile
@@ -0,0 +1,5 @@
+#
+# ~/.bash_profile
+#
+
+[[ -f ~/.bashrc ]] && . ~/.bashrc
diff --git a/bash/bashrc b/bash/bashrc
index 2c43535..03e1d31 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -1,18 +1,15 @@
-# ~/.bashrc: executed by bash(1) for non-login shells. (That's why ~/.profile
-# is needed. To source it from login shells? What does login shell mean
-# anyway).
-
+#
+# ~/.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
-# Basic
-# ======================================================================
-
# If not running interactively, don't do anything
-case $- in
- *i*) ;;
- *) return;;
-esac
+[[ $- != *i* ]] && return
+
+
+# Bash configuration
+# ==================
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
@@ -26,7 +23,7 @@ HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
-# update the values of LINES and COLUMNS.
+# 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
@@ -37,58 +34,44 @@ shopt -s checkwinsize
#[ -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'
+#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
-# enable programmable completion features (you don't need to enable
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc). Requires `bash-completion package
-if ! shopt -oq posix; then
- if [ -f /usr/share/bash-completion/bash_completion ]; then
- . /usr/share/bash-completion/bash_completion
- elif [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
- fi
-fi
+# Don't forget to install bash-completion
-# set PATH so it includes user's private bin if it exists
-if [ -d "$HOME/.local/bin" ] ; then
- PATH="$HOME/.local/bin:$PATH"
-fi
+# Prompt
+# ------
-# Custom 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\$ '
-# If error `-bash: __git_ps1: command not found`, uncomment the following line
+
+# - user@host pwd (git prompt)
# Ref.: https://stackoverflow.com/a/15398153/7498073
-source ~/.git-prompt.sh
-# user@host pwd (git prompt)
+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$ '
-# Extra
-# ======================================================================
-
-# My binaries
-if [ -d "$HOME/mahcode/bin" ]; then
- PATH="$HOME/mahcode/bin:$PATH"
-fi
+# Environment
+# ===========
-# Default editor. Affects a lot of programs.
-export EDITOR=vim
+export EDITOR=nvim
+export PATH="$HOME/.local/bin:$PATH"
+export PATH="$HOME/mahcode/bin:$PATH"
-# redundant but useful
# 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_DATA_DIRS="/usr/local/share:/usr/share"
-#export XDG_CONFIG_DIRS="/etc/xdg"
+export XDG_STATE_HOME="$HOME/.local/state"
+
+export LC_COLLATE=C
# less
LESS="-i " # ignore case
@@ -96,46 +79,26 @@ LESS+="-S " # don't chop long lines
LESS+="--RAW-CONTROL-CHARS"
export LESS
+# Extra programs
+# --------------
+
# tldr
-export TLDR_CONFIG_DIR="$XDG_CONFIG_HOME"
+[ -f /usr/bin/tldr ] && export TLDR_CONFIG_DIR="$XDG_CONFIG_HOME"
# gpg
-export GPG_TTY=$(tty)
+#export GPG_TTY=$(tty)
# tmux
-export TERM="xterm-256color"
-
-# EGA/VGA font (used with ArchLinux in pre-Xorg session)
-#if [ -z $DESKTOP_SESSION ]; then
-# setfont LatGrkCyr-8x16
-#fi
+#export TERM="xterm-256color"
# nvm
-source /usr/share/nvm/init-nvm.sh
-
-
-
-# Optional
-# ======================================================================
+#source /usr/share/nvm/init-nvm.sh
-# Bash completition for pandoc
+# Pandoc: Bash completition for pandoc
if [ -f /usr/bin/pandoc ]; then
eval "$(pandoc --bash-completion)"
fi
-# Greeting or salute
-if [ -f /usr/games/cowsay ] || [ -f /usr/bin/cowsay ]; then
- # TODO: randomly select one of the following greeting commands
- #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
-
# Homebrew (linuxbrew)
if [ -f /usr/bin/brew ]; then
# for elf executables
@@ -147,15 +110,31 @@ if [ -f /usr/bin/brew ]; then
fi
# Node.js
-export NODE_PATH=~/code/nodejs/node-v16.15.1-linux-x64/lib/node_modules
+#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"
+#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