# ~/.bashrc # If not running interactively, don't do anything [[ $- != *i* ]] && return export CDPATH=.:.. export PAGER=less export EDITOR=vim # export MANPAGER='vim +MANPAGER --not-a-term -' 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" [ "$TERM" = xterm-256color ] && export COLORTERM=truecolors # export GNUTERM='sixelgd enhanced truecolor font "arial,9"' # OS=${OS:-$(~/bin/os)} # Support different operating system environments case $OS in (arch|alpine|fedora-asahi-remix) alias ls='ls --color=auto -v' ll='ls -AlFhv' [ "$OS" = arch ] || trap 'printf "\e]2;%s\a" "$TERM_TAG ${BASH_COMMAND%ps1}"' DEBUG ;; (Darwin) # alias ibrew='arch -x86_64 /usr/local/bin/brew' . /opt/local/etc/profile.d/bash_completion.sh . /opt/local/share/fzf/shell/completion.bash alias ls='ls -GF' ll='ls -AlGFhv' alias ldd='otool -L' trap 'printf "\e]2;%s\a" "$TERM_TAG ${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 # Exported functions d() { date +%F; } p() { [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; } export -f d p # [ "$OS" = alpine ] && export MANPAGER='vim +MANPAGER --not-a-term' export LESS=iXFRx4 # export SHELLCHECK_OPTS='-S warning' #export BACKUP=bip:/home/backup/marc@$(hostname -s) # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' alias apk='doas apk' alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' alias 2fz='2fa -list | fzf | xargs 2fa -clip' alias fd='find . -iname' alias gdt='dlv test -- -test.v -test.run' alias gob='go build' alias god='p go doc' alias goh='p go help' alias gol='GO111MODULE=off go' alias grep='grep -i --color' alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench' alias gtr='go test -v -run' alias more='less' alias oman='MANPAGER=$PAGER man' alias rg='rg --smart-case' alias rot13='tr A-Za-z N-ZA-Mn-za-m' alias vi='vim' alias view='vim -R' #alias vi='nvi' #alias view='nview' #alias ex='nex' alias ww='vim ~/Wiki/home_page.md' alias y='rlwrap yaegi' alias mp='rlwrap mp' alias hd='hexdump -C' alias pacman='sudo pacman' alias wtree='swaymsg -t get_tree' # 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() { local pkgs 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