Created
December 5, 2016 01:23
-
-
Save ma-al/d63c3d943f2f99fed250fc859320f4fb to your computer and use it in GitHub Desktop.
shell comforts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} - ${PWD}\007"' | |
[ -z "$PS1" ] && return | |
PS1="\[\e[0;36m\]\[\e[1;33m\]>>>>\[\e[0m\] " | |
complete -cf sudo | |
export PAGER=less | |
export EDITOR=vim | |
export HISTCONTROL=ignorespace:ignoredups | |
export HISTIGNORE="l:c:x:hg:history" | |
export HISTSIZE=30000 | |
export HISTFILESIZE=30000 | |
export XDG_CONFIG_HOME="$HOME/.config" | |
alias c=clear | |
alias l='ls -Flh --color=auto --time-style=long-iso' | |
alias ll='ls -FCAlh --color=auto --time-style=long-iso' | |
alias lp='ls -ld --color=auto --time-style=long-iso */' | |
alias lk="readlink -f " | |
alias xx=exit | |
alias hg='history | grep -v hg | grep -i ' | |
alias fp='ps aux | grep -v grep | grep -i ' | |
alias ps3='pstree -cupsa' | |
alias grep='grep --color=always ' | |
alias grin='grep -rIn' | |
alias ips="ip -o addr show scope global | awk '{gsub(/\/.*/, \" \",\$4); print \$4}'" | |
alias dus="du -h | sort -hr | head -40" | |
alias cd="pushd 1> /dev/null " | |
alias pd="popd 1> /dev/null " | |
alias cdd="cd ~/" | |
alias gclo="git clone" | |
alias gsta="git status" | |
alias gadd="git add" | |
alias gbra="git branch -v" | |
alias grem="git remote -v" | |
alias gcov="git count-objects -v" | |
alias glog="git log --oneline" | |
alias gchk="git checkout" | |
alias gcsa="git commit -sa" | |
alias gcom="git commit -s" | |
alias gpll="git pull" | |
alias gpsh="git push" | |
alias dpsa="docker ps -a" | |
alias dpse="docker ps --filter=\"status=exited\"" | |
alias dpsn="dpsa | tail -n +2 | awk -v OFS='\\t' '{print \$1, \$NF, \$2}'" | |
alias dima="docker images" | |
alias drme="docker ps -q --no-trunc --filter=\"status=exited\" | xargs docker rm" | |
alias drmi="docker images | grep \"^<none>\" | awk '{print \$3}' | xargs docker rmi" | |
alias dlog="docker logs -f " | |
function details | |
{ | |
IPADDR=`ips` | |
echo | |
echo "============================" | |
echo " USER: "$USER | |
echo " HOST: "$HOSTNAME | |
echo | |
for addr in `ips`; do | |
echo " ADDR: $addr" | |
done | |
echo "============================" | |
echo | |
} | |
alias det="details" | |
det | |
function previm | |
{ | |
file="$1" | |
echo | |
if [ $# -gt 1 ]; then | |
echo "Augh! I can only handle one argument!"; | |
echo | |
echo "If you wanted vim to open up multiple files..." | |
echo "... do $(which vim) file1 file2 instead."; | |
echo; return | |
fi | |
if [[ $file == *" "* ]]; then | |
echo "Augh! Please sir, I cannot handle spaces in file names."; | |
echo; return | |
fi | |
echo "Opening ($file)..."; | |
echo | |
if [ -z "$file" ]; then | |
echo "Nein! Nein! Nein! No file was given!"; | |
echo; return | |
fi | |
if [ -d $file ]; then | |
echo "Sacre blue! ($file) es un directory monsieur!"; | |
echo; return | |
fi | |
if [ ! -e $file ]; then | |
echo "($file) is having existential issues."; | |
echo -n "Create it? (y/n): "; | |
read yesno | |
if [ "$yesno" == "y" ]; then | |
echo | |
touch $file || return | |
echo "($file) has materialized from the warp!" | |
echo; /usr/bin/vim $file | |
fi | |
echo; return | |
fi | |
if [ ! -w $file ]; then | |
echo "Deus mio! ($file) is not writable by ($USER)"; | |
echo; return | |
fi | |
echo; /usr/bin/vim $file | |
} | |
alias vim="previm" | |
stty werase undef | |
bind '\C-w:unix-filename-rubout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
set backspace=2 | |
set nu | |
set ruler | |
set autoindent | |
set smartindent | |
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab | |
set term=xterm | |
set whichwrap+=<,>,[,] | |
set backspace=indent,eol,start | |
set hlsearch | |
colorscheme peachpuff | |
syntax on | |
function s:ForbidReplace() | |
if v:insertmode isnot# 'i' | |
call feedkeys("\<Insert>", "n") | |
endif | |
endfunction | |
augroup ForbidReplaceMode | |
autocmd! | |
autocmd InsertEnter * call s:ForbidReplace() | |
autocmd InsertChange * call s:ForbidReplace() | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment