Created
November 4, 2015 05:03
-
-
Save smutch/91deef7c6a4bf2f45e3f to your computer and use it in GitHub Desktop.
dotfiles
This file contains hidden or 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
config defaultToCurrentScreen true | |
config windowHintsShowIcons true | |
config windowHintsIgnoreHiddenWindows false | |
config windowHintsSpread true | |
# Monitor Aliases | |
alias mon-laptop 1440x900 | |
alias mon-thunderbolt 2560x1440 | |
alias mon-dell 1920x1080 | |
bind .:cmd hint ASDFGHJKLQWERTY | |
# bind ':cmd grid padding:5 1440x900:3,2 2560x1440:4,3 1920x1080:4,3 | |
bind ':cmd grid padding:5 1440x900:4,2 2560x1440:4,3 1920x1080:4,3 | |
# Abstract positions | |
alias full move screenOriginX;screenOriginY screenSizeX;screenSizeY | |
alias lefthalf move screenOriginX;screenOriginY screenSizeX/2;screenSizeY | |
alias left23rds move screenOriginX;screenOriginY 2*screenSizeX/3;screenSizeY | |
alias righthalf move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY | |
alias right13rd move screenOriginX+2*screenSizeX/3;screenOriginY screenSizeX/3;screenSizeY | |
alias topleft corner top-left resize:screenSizeX/2;screenSizeY/2 | |
alias topright corner top-right resize:screenSizeX/2;screenSizeY/2 | |
alias bottomleft corner bottom-left resize:screenSizeX/2;screenSizeY/2 | |
alias bottomright corner bottom-right resize:screenSizeX/2;screenSizeY/2 | |
# layouts | |
layout writing 'Skim' ${lefthalf} | |
layout writing 'MacVim' ${righthalf} | |
layout writing 'iTerm2' ${righthalf} | |
bind w:ctrl;alt;cmd layout writing |
This file contains hidden or 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
# Source Prezto. | |
source $HOME/.zprezto/runcoms/zshrc | |
# Fix run-help for homebrew installation | |
unalias run-help | |
autoload run-help | |
HELPDIR=/usr/local/share/zsh/helpfile | |
# zsh completions | |
fpath=(/usr/local/share/zsh-completions $fpath) | |
# don't use git completion etc. on sshfs mounts | |
zstyle ':vcs_info:*' disable-patterns "$HOME/Remotes/*" | |
# z | |
. `brew --prefix`/etc/profile.d/z.sh | |
unalias z | |
z() { | |
if [[ -z "$*" ]]; then | |
cd "$(_z -l 2>&1 | fzf-tmux +s --tac | sed 's/^[0-9,.]* *//')" | |
else | |
_last_z_args="$@" | |
_z "$@" | |
fi | |
} | |
zz() { | |
cd "$(_z -l 2>&1 | sed 's/^[0-9,.]* *//' | fzf-tmux -q $_last_z_args)" | |
} | |
export EDITOR="nvim" | |
export VISUAL="nvim" | |
export LESS="-R" | |
export PAGER="less" | |
## | |
## Set up the display | |
## | |
if [ -z "$DISPLAY" ]; then | |
export DISPLAY=:0.0 | |
fi | |
## | |
## Some aliases | |
## | |
alias pv='open -a preview' | |
alias combine_pdf="gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=combined.pdf $*" | |
alias finder='open -a finder' | |
alias pdf2png='convert -density 600X600 -resize 800X560 -quality 90' | |
alias pdf2png_batch="convert_pdf" | |
alias erc="nvim --cmd 'set mouse=a' ~/.vim/vimrc" | |
alias cdv="cd ~/.vim" | |
alias v="nvim --cmd 'set mouse=a'" | |
alias vdiff="nvimdiff --cmd 'set mouse=a'" | |
alias mvimt="mvim --remote-tab" | |
alias ipycalc='ipython -i -c "import numpy as np; import astropy.units as U; import astropy.constants as C; import astropy.cosmology as cosmo"' | |
## | |
## Utility functions | |
## | |
export FZF_DEFAULT_OPTS="-x" | |
calc() { | |
awk "BEGIN{ print $* }" | |
} | |
function convert_pdf() { | |
for f in $( ls *.pdf | cut -d'.' -f1); do | |
pdf2png $f.pdf $f.png | |
done | |
} | |
function del() { | |
while [ -n "$1" ]; do | |
local file=`basename "$1"` | |
# Chop trailing '/' if there | |
file=${file%/} | |
local destination="" | |
if [ -e "$HOME/.Trash/$file" ]; then | |
# Extract file and extension | |
local ext=`expr "$file" : ".*\(\.[^\.]*\)$"` | |
local base=${file%$ext} | |
# Add a space between base and timestamp | |
test -n "$base" && base="$base " | |
destination="/$base`date +%H-%M-%S`_$RANDOM$ext" | |
fi | |
echo "Moving '$1' to '$HOME/.Trash$destination'" | |
mv "$1" "$HOME/.Trash$destination" | |
shift | |
done | |
} | |
# Get the full path | |
function fpth() { | |
if [[ -f $1 ]];then | |
echo $(cd $(dirname $1) && pwd)/$(basename $1) | |
else | |
echo "File not found" >&2 | |
fi | |
} | |
# Grep functions | |
function gc() { | |
grep -In --color=always "$*" *.c | |
} | |
function gpy() { | |
grep -In --color=always "$*" *.py | |
} | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Bookmarks | |
# Module: Change directory with bookmarks | |
# Path: bin/zsh-modules-available/cdbookmarks | |
# Priority: 90 | |
# | |
# (C) by Ivan Cukic, 2010-present | |
# (C) by Stan Angeloff, 2010-present | |
ZSH_BOOKMARKS="$HOME/.zsh/cdbookmarks" | |
zmodload zsh/pcre | |
setopt REMATCH_PCRE | |
function cdb_edit() { | |
$EDITOR "$ZSH_BOOKMARKS" | |
} | |
function cdb() { | |
local index | |
local entry | |
index=0 | |
for entry in $(echo "$1" | tr '/' '\n'); do | |
if [[ $index == "0" ]]; then | |
local CD | |
CD=$(egrep "^$entry " "$ZSH_BOOKMARKS" | sed "s#^$entry *##") | |
if [ -z "$CD" ]; then | |
echo "$0: no such bookmark: $entry" | |
break | |
else | |
echo $CD | |
cd "$CD" | |
fi | |
else | |
cd "$entry" | |
if [ "$?" -ne "0" ]; then | |
break | |
fi | |
fi | |
let "index++" | |
done | |
} | |
function _cdb() { | |
current_string=$words[2] | |
if [[ "$current_string" = */* ]]; then | |
head=${current_string%%/*} | |
body="" | |
tail=${current_string#*/} | |
if [[ "$tail" = */* ]]; then | |
body=${tail%/*}/ | |
tail=${tail##*/} | |
fi | |
expanded_path=(`grep "$head" "$ZSH_BOOKMARKS" | sed -e 's#^[^\d\W]*\s##g'`) | |
reply=(`find "$expanded_path"/"$body" -name "$tail*" -maxdepth 1 -mindepth 1 -type d -printf '%P\n' 2> /dev/null | sed 's#^.*$#'$head'/'$body'\0/#'`) | |
else | |
reply=(`cat "$ZSH_BOOKMARKS" | sed -e 's#^\(.*\)\s.*$#\1/#g'`) | |
fi | |
} | |
compctl -K _cdb -S '' cdb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment