# ~/.bashrc # If not running interactively, don't do anything [[ $- != *i* ]] && return export PAGER=less export EDITOR=vim export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:tc:top:history' export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries export HISTSIZE=100000 # big big history export HISTFILESIZE=100000 # big big history shopt -s histappend # append to history, don't overwrite it shopt -s globstar shopt -s dotglob stty -ixon # disable Ctrl-S # Save and reload the history after each command finishes #export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" # export GNUTERM='sixelgd enhanced truecolor font "arial,9"' # OS=${OS:-$(~/bin/os)} # Support different operating system environments case $OS in (arch|alpine) alias ls='ls --color=auto -v' ll='ls -AlFhv' [ "$OS" = arch ] || trap 'printf "\e]2;%s\a" "${BASH_COMMAND%ps1}"' DEBUG ;; (Darwin) alias ls='ls -GF' ll='ls -AlGFhv' alias ldd='otool -L' alias ibrew='arch -x86_64 /usr/local/bin/brew' trap 'printf "\e]2;%s\a" " ${BASH_COMMAND%update_terminal_cwd}"' DEBUG ;; (termux) PATH=~/bin:${HOME%/*}/usr/bin:~/go/bin type eza >/dev/null && alias ls='eza' ll='eza -lao --no-user --no-permissions' || alias ls='ls --color=auto -v' ll='ls -AlFhv' ;; esac p() { [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; } export -f p export LESS=iXFRx4 #export BACKUP=bip:/home/backup/marc@$(hostname -s) # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' alias grep='grep -i --color' alias more='less' alias vi='vim' alias view='vim -R' alias gob='go build' alias goh='p go help' alias god='p go doc' alias gol='GO111MODULE=off go' alias gtr='go test -v -run' alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench' alias gdt='dlv test -- -test.v -test.run' alias ww='vi ~/Wiki/home_page.md' alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' alias apk='doas apk' alias rg='rg --smart-case' alias y='rlwrap -pblue yaegi' alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' # yaegi debug export YAEGI_DOT_CMD='dotty -' export YAEGI_UNSAFE=1 export YAEGI_UNRESTRICTED=1 export YAEGI_SYSCALL=1 sshs() { ssh -t "$@" -- screen -d -R; } man() { local width='' [ $(tput cols) -gt 88 ] && width='MANWIDTH=88' env $width man "$@" } meteo() { local request="wttr.in/${1-Toulouse}?F&T" [ "$(tput cols)" -lt 125 ] && request+='&n' curl -H "Accept-Language: fr" --compressed "$request" } eval "$(fzf --bash)" >/dev/null # Handle missing commands, unless already provided. type -t command_not_found_handle >/dev/null || command_not_found_handle() { case $OS in (alpine) pkgs=$(apk list -Pq "cmd:$1" | awk '{print $2}') ;; (arch) pkgs=$(pkgfile -b "$1") ;; (Darwin) pkgs=$(brew which-formula "$1") ;; esac echo "$1: command not found${pkgs:+. Present in: $pkgs}" >&2 } # Display git status in prompt . ~/.bash-powerline.sh