1
0
Fork 0
vdotfiles/cli/.bashrc

56 lines
1.4 KiB
Bash
Raw Normal View History

# shellcheck shell=bash
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
HISTSIZE=1000
2018-07-10 03:25:36 +03:00
HISTFILE="$HOME/.bash_history.$UID"
HISTCONTROL=ignoredups
2018-07-11 13:26:42 +03:00
shopt -s histappend checkwinsize autocd
export LESS='i M R'
export PAGER=less
export EDITOR=vim
export TIME_STYLE=long-iso
2018-07-10 03:25:36 +03:00
export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"
2023-10-03 15:31:55 +03:00
PS1='\[\e[0m\][ \u@\h \[\e[34m\]\w\[\e[0m\] ]\n\$ '
unalias ls ld ll 2>/dev/null
beep() { printf "\007"; }
2024-09-05 18:33:30 +03:00
fixterm() { printf "\u001bc"; }
diff() { command diff --color "$@"; }
tailf() { command less +F "$@"; }
rgrep() { command grep --exclude-dir=\.git -R "$@"; }
whence() { command -v "$@"; }
2018-07-10 03:25:36 +03:00
# ls
2023-08-25 18:15:26 +03:00
ls() { command ls --color=auto "$@"; }
ll() { ls -alh "$@"; }
2023-08-25 18:15:26 +03:00
ld() { ls -dlh "$@"; }
2018-07-10 03:25:36 +03:00
# git
gci() { command git commit "$@"; }
gsl() { command git stash list "$@"; }
gss() { command git status -sbu "$@"; }
gup() { command git pull "$@"; }
groot() { cd "$(command git rev-parse --show-cdup)" || return 1; }
ggrep() { command git grep "$@"; }
gsi() { command tig status; }
2018-07-10 03:25:36 +03:00
# tmux
tmux() { command tmux -2 "$@"; }
atmux() { tmux attach; }
2018-07-10 03:25:36 +03:00
# sudo
sush() { command sudo -Es; }
2018-07-10 03:25:36 +03:00
# bash-completion
completion_path='/usr/share/bash-completion/bash_completion'
[[ -r "$completion_path" ]] && source "$completion_path"
# we want to see exit code on error (it also has to be the last entry here)
trap_msg='\e[31m>>\e[0m exit \e[31m%s\e[0m\n'
2019-02-07 14:21:37 +02:00
trap 'printf "$trap_msg" "$?" >&2' ERR