From 444f12c8440188bf8849b7b822ea3f01e6dce34a Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 13 Apr 2014 22:04:55 -0700 Subject: [PATCH] Git diff add bump .emacs.d remove useless aliases. --- dotfiles/emacs.d | 2 +- dotfiles/gitconfig | 2 ++ dotfiles/lib/shellrc/aliases.sh | 27 ++++----------------------- dotfiles/lib/shellrc/functions.sh | 17 +++++++++++++++++ dotfiles/lib/shellrc/prompt.sh | 0 dotfiles/lib/zsh/prompt.sh | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 dotfiles/lib/shellrc/prompt.sh diff --git a/dotfiles/emacs.d b/dotfiles/emacs.d index 80834324..a026244b 160000 --- a/dotfiles/emacs.d +++ b/dotfiles/emacs.d @@ -1 +1 @@ -Subproject commit 80834324ebb10a1ebe4617930b70c8f9b6ae362f +Subproject commit a026244b86416f3ef7137b915cb1699ad1d977f0 diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index 506839af..2ff1dbab 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -15,6 +15,8 @@ reb = "!r() { git rebase -i HEAD~$1; }; r" suir = submodule update --init --recursive poh = push origin HEAD + du = "!d() { git ls-files $1 --error-unmatch 2>/dev/null 1>/dev/null && git diff $1 || `git config --get core.pager` $1; }; d" + amend = commit -a --amend -C HEAD [core] # Use custom `.gitignore` and `.gitattributes` diff --git a/dotfiles/lib/shellrc/aliases.sh b/dotfiles/lib/shellrc/aliases.sh index 4854652d..fe065627 100644 --- a/dotfiles/lib/shellrc/aliases.sh +++ b/dotfiles/lib/shellrc/aliases.sh @@ -1,6 +1,8 @@ -alias script_abspath='$(dirname "${BASH_SOURCE}" | xargs "${readlink_command}" -f)' - alias emacs="emacsclient -t" +alias tmux="tmux -2" +alias remote_os_copy='linux_nc_paste_to_remote_clipboard' +alias tmux_cb_to_remote_cb='tmux saveb - | linux_nc_paste_to_remote_clipboard' +alias timestamp='date +%s' # enables the sudoing of aliases. alias sudo='sudo ' @@ -19,27 +21,11 @@ alias localip="ifconfig getifaddr en1" alias whois="whois -h whois-servers.net" -# Clean up LaunchServices to remove duplicates in the “Open With” menu -alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" - # View HTTP traffic alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" - -# Canonical hex dump; some systems have this symlinked -command -v hd > /dev/null || alias hd="hexdump -C" - -# OS X has no `md5sum`, so use `md5` as a fallback -command -v md5sum > /dev/null || alias md5sum="md5" - -# OS X has no `sha1sum`, so use `shasum` as a fallback -command -v sha1sum > /dev/null || alias sha1sum="shasum" - command -v greadlink > /dev/null && alias readlink="greadlink" -# URL-encode strings -alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' - # Merge PDF files # Usage: `mergepdf -o output.pdf input{1,2,3}.pdf` alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py' @@ -56,8 +42,3 @@ done alias stfu="osascript -e 'set volume output muted true'" alias pumpitup="osascript -e 'set volume 7'" - -alias tmux="tmux -2" -alias remote_os_copy='linux_nc_paste_to_remote_clipboard' -alias tmux_cb_to_remote_cb='tmux saveb - | linux_nc_paste_to_remote_clipboard' -alias timestamp='date +%s' diff --git a/dotfiles/lib/shellrc/functions.sh b/dotfiles/lib/shellrc/functions.sh index d7eee873..f0fd85e9 100644 --- a/dotfiles/lib/shellrc/functions.sh +++ b/dotfiles/lib/shellrc/functions.sh @@ -16,6 +16,23 @@ function is_zsh() { test -n "$(current_shell | grep -o zsh)" } +function git_diff_add() { + git status --porcelain | awk '{print $2}' | xargs -I filename sh -c "git du filename && git add filename" +} + +function confirm() { + # call with a prompt string or use a default + read -r -p "$1" response + case $response in + [yY][eE][sS]|[yY]) + return 0 + ;; + *) + return 1 + ;; + esac +} + function get_cols() { FS=' ' while getopts "F:" OPTCHAR; do diff --git a/dotfiles/lib/shellrc/prompt.sh b/dotfiles/lib/shellrc/prompt.sh deleted file mode 100644 index e69de29b..00000000 diff --git a/dotfiles/lib/zsh/prompt.sh b/dotfiles/lib/zsh/prompt.sh index 391e6ae0..008cf9cd 100644 --- a/dotfiles/lib/zsh/prompt.sh +++ b/dotfiles/lib/zsh/prompt.sh @@ -33,4 +33,4 @@ $FG[255]╰─± ' PS2='' -RPROMPT='%!' +RPROMPT='Last Exit Code: $?'