Files
dots/bash/.bashrc
2020-05-30 22:03:04 -05:00

119 lines
2.7 KiB
Bash

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
#export SYSTEMD_PAGER=
#pager setup
#-C faster reprints
#-F auto quit if less than 1 screen
#-M more status
#-I case insensitive
#-j 5 show X lines above search for context
#-R fix ansi esc sequences
## 4 - right/left four chars
export LESS='-C -M -j 3 -R -# 2'
# User specific aliases and functions
alias l.='ls -lh --time-style=long-iso --color' 2>/dev/null
alias l='ls -lh --color --time-style=long'
alias ll='ls -lAh --color --time-style=long'
alias lsd='l -d */'
alias p='ping'
alias dmesg='dmesg -H'
alias ip='ip -c'
#alias s='sudo $(history -p !!)'
alias s='sudo'
#not sure why fedora doesnt set this or what it might break but here we go
export XDG_CONFIG_HOME=$HOME/.config
# make tab after cd only complete using dir names
complete -d cd
#golang stuff
export GOPATH=$HOME/gopath
export PATH=$GOPATH:$GOPATH/bin:$PATH
export NNN_SHOW_HIDDEN=1
if [ -f "/usr/bin/vimx" ]; then
export EDITOR=/usr/bin/vimx
else
export EDITOR=/usr/bin/vim
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
#ctrl-x, ctrl-e to launch $EDITOR (vim)
#bind -m vi-insert '"\C-x\C-e": edit-and-execute-command'
#fix clear screen in vi mode
#bind -m vi-insert "\C-l":clear-screen
# HISTORY
#add date/time to history
export HISTTIMEFORMAT="%F %T: "
export HISTSIZE=2000
export HISTFILESIZE=5000
#if tty -s; then
if [ -t 1 ]; then
export PS1="\[$(tput bold)\]\[$(tput setaf 4)\][\u@\h \W]\\$ \[$(tput sgr0)\]"
fi
if [ ! -z "$VIRTUAL_ENV" ]; then
#export PS1="[$(basename "$VIRTUAL_ENV")] \[\u@\h \W]\\$"
export PS1="[$(basename "$VIRTUAL_ENV")] $PS1"
fi
# fedoras stupid command-not-found shit
unset command_not_found_handle
if [ -f /usr/share/fzf/shell/key-bindings.bash ]; then
source /usr/share/fzf/shell/key-bindings.bash
fi
ex() {
local c e i
(($#)) || return
for i; do
c=''
e=1
if [ $# -eq 0 ]; then
echo "No file specified"
exit
fi
if [[ ! -r $i ]]; then
echo "$0: file is unreadable: \`$i'" >&2
continue
fi
case $i in
*.tar) c=(tar xf);;
*.7z) c=(7z x);;
*.Z) c=(uncompress);;
*.bz2) c=(bunzip2);;
*.exe) c=(cabextract);;
*.gz) c=(gunzip);;
*.rar) c=(unrar x);;
*.xz) c=(unxz);;
*.zip) c=(unzip);;
*) echo "$0: unrecognized file extension: \`$i'" >&2
continue;;
esac
command "${c[@]}" "$i"
((e = e || $?))
done
return "$e"
}