.sh

Multi-shell dotfiles manager
git clone https://git.torresjrjr.com/.sh.git
Log | Files | Refs | README | LICENSE

.rc.sh (1263B)


      1 #
      2 # .rc.sh
      3 #
      4 # The common POSIX script for interactive shells
      5 
      6 
      7 ## Env
      8 
      9 FETCH="${FETCH:-fetch}"
     10 
     11 
     12 ## Settings
     13 
     14 set -o vi
     15 
     16 
     17 ## Aliases
     18 
     19 # bulitins
     20 alias c='clear'
     21 alias rs='clear; . $DOTSHELL/sh/.rc.sh'  # overwritten
     22 alias ls='ls -w 80 --color=auto --group-directories-first'
     23 alias la='ls -FAXC'
     24 alias ll='ls -FAXlh'
     25 
     26 # externals
     27 alias tree='tree -C --dirsfirst'
     28 alias diff='diff --color=auto'
     29 alias grep='grep --color=auto'
     30 
     31 alias gits='git status -s'
     32 alias gitss='git status -v'
     33 alias gitd='git diff'
     34 alias gitds='git diff --staged'
     35 alias gitl='git log --oneline --decorate --graph --all -10'
     36 alias gitll='git log --oneline --decorate --graph --all'
     37 
     38 
     39 ## Functions
     40 
     41 info() {
     42 	$FETCH
     43 	ls -FAX ; echo
     44 	git log -0 2>&- && {  # if git repo
     45 		git log -1 --abbrev-commit --format=short --color --decorate \
     46 		| sed -n '1p; /^    /p'
     47 		git status -s
     48 		echo
     49 	}
     50 }
     51 
     52 gitf() {
     53 	echo ">>>"
     54 	git fetch $1
     55 	echo "<<<"
     56 	gitlf $1 $2
     57 	echo "---"
     58 	git status
     59 }
     60 
     61 gitlf() {
     62 	remote=${1:-origin}
     63 	branch=${2:-$(git branch | grep '^\*' | cut -d' ' -f2)}
     64 	git log --oneline --decorate --graph --color \
     65 		"$branch" "$remote/$branch" \
     66 		"$( git merge-base "$branch" "$remote/$branch" )^!"
     67 }
     68 
     69 ## Local
     70 
     71 test -f "$DOTSHELL/local/.rc.sh" &&
     72 	. "$DOTSHELL/local/.rc.sh"
     73 
     74 
     75 ## Runtime
     76 
     77 info