diff --git a/aliases b/aliases new file mode 100644 index 0000000..3d93134 --- /dev/null +++ b/aliases @@ -0,0 +1,87 @@ +# aliases for apache and mysql +alias apachestart='_ /usr/sbin/apachectl start' +alias apachestop='_ /usr/sbin/apachectl stop' +alias mysqlstart='mysql.server start' +alias mysqlstop='mysql.server stop' +alias dev='apachestart && mysqlstart' +alias devs='apachestop && mysqlstop' +alias devr='devs && dev' + + +# noglobbing aliases +alias jake='noglob jake' +alias g="noglob git" + + +# Gitty gitgit -- use aliases from oh-my-zsh plugins +alias gitrm='git rm $(git ls-files --deleted)' +alias gsmu='git submodule init && git submodule update' +alias em='$EDITOR $(git ls-files -m)' + + +# dandelion deployment shortcuts +alias deploy='dandelion deploy' +alias status='dandelion status' + + +# grunt +alias gr='grunt' +alias grw='grunt watch' +alias grd='grunt deploy' + + +# tmux +alias t='tmux -u -2' +alias ta='tmux attach' + + +# random usefull stuff +alias dnsflush='_ dscacheutil -flushcache' +alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" +alias psa="ps aux" + + +# all in one homebrew, gem update commands +alias brewup='brew update && brew upgrade && brew cleanup && brew linkapps' +alias gemup='gem update --system && gem update && gem cleanup' +alias npmup='npm -g cache clean && npm -g update' +alias rvmup='rvm get latest' +alias sysup='_ softwareupdate -i -a' +alias upall='sysup && brewup && rvmup && gemup && npmup' + + +# alias for re-installing npm from the web and default packages +alias npmins="curl" + +# always use macvim but for 'vim' +alias vim=$EDITOR +alias vi=$EDITOR +alias v=$EDITOR +alias vd='vimdiff' +alias diff='vimdiff' + + +# easy hosts / apache / php editing +alias hosts='_ vim /etc/hosts' +alias vhosts='_ vim /etc/apache2/extra/httpd-vhosts.conf' +alias phpini='vim /usr/local/etc/php/5.4/php.ini' +alias http='_ vim /etc/apache2/httpd.conf' + + +# Easier navigation: .., ..., ~ and - +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' +alias l='ls -al' +alias e='exit' + + +# often used folder shortcuts +alias drop='cd ~/Dropbox && ls -al' +alias web='cd ~/Sites && ls -al' +alias rep='cd ~/Repositories && ls -al' +alias dot='cd ~/Dotfiles && ls -al' +alias brain='cd ~/Dropbox/Brain && vim .' + + diff --git a/exports b/exports new file mode 100644 index 0000000..72eef2f --- /dev/null +++ b/exports @@ -0,0 +1,24 @@ +# Terminal +export TERM="screen-256color" + +# brew CASK +export HOMEBREW_CASK_OPTS="--appdir=/Applications" + +# paths +export PATH=/usr/local/bin:/usr/local/sbin:$HOME/.rvm/bin:$PATH +export MANPATH=/usr/local/share/man:$MANPATH + +# disable stupid ._ and dsstore files +export COPY_EXTENDED_ATTRIBUTES_DISABLE=true +export COPYFILE_DISABLE=true + +# editor +export EDITOR="~/Applications/MacVim.app/Contents/MacOS/Vim" +export VISUAL="~/Applications/MacVim.app/Contents/MacOS/Vim" + +# node.js +export NODE_PATH=/usr/local/lib/jsctags/:$NODE_PATH + +# disable auto titling fixes tmux window +export DISABLE_AUTO_TITLE=true + diff --git a/functions b/functions new file mode 100644 index 0000000..0a51907 --- /dev/null +++ b/functions @@ -0,0 +1,47 @@ +# a small function for finding stuff +function fname() { + find . -iname "*$@*"; +} + + +# find process by name and kill them +function grepkill() { + ps -axf | grep -v grep | grep "$@" | awk '{print $2}' | xargs kill +} + + +# open changed files in git index +function gch () { + vim `git status | grep modified | awk '{print $3}'` +} + + +# creates an archive from given directory +mktar() { tar cvf "${1%%/}.tar" "${1%%/}"; } +mktgz() { tar cvzf "${1%%/}.tgz" "${1%%/}"; } +mktbz() { tar cvjf "${1%%/}.tbz" "${1%%/}"; } +mkzip() { zip -r "${1%%/}" "${1%%/}"; } + + +# easy extract +extract () { + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xvjf $1 ;; + *.tar.gz) tar xvzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) rar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xvf $1 ;; + *.tgz) tar xvzf $1 ;; + *.tbz2) tar xvjf $1 ;; + *.tbz) tar xvjf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "don't know how to extract '$1'..." ;; + esac + else + echo "'$1' is not a valid file!" + fi +} diff --git a/vimrc b/vimrc index cdb6555..97105f0 100644 --- a/vimrc +++ b/vimrc @@ -24,6 +24,8 @@ Bundle 'godlygeek/tabular' Bundle 'kien/ctrlp.vim' Bundle 'mattn/gist-vim' Bundle 'mattn/webapi-vim' +Bundle 'rizzatti/dash.vim' +Bundle 'rizzatti/funcoo.vim' Bundle 'rking/ag.vim' Bundle 'scrooloose/nerdtree' Bundle 'scrooloose/syntastic' @@ -213,7 +215,7 @@ nnoremap - sj " open a new split and edit the vimrc // easy sourcing vimrc nnoremap v vl :e ~/.vimrc -nnoremap s :source ~/.vimrc +nnoremap vs :source ~/.vimrc " Opens an edit command with the path of the currently edited file filled in nnoremap e :e =expand("%:p:h") . "/" @@ -270,10 +272,10 @@ nmap u mQviwU`Q nmap l mQviwu`Q " Swap two words -nmap w :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/`' +nmap sw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/`' " change working directory to current file -nnoremap d :cd %:p:h:pwd +nnoremap w :cd %:p:h:pwd " reload files when set autoread is active with F5 " TODO make this awesome reloading NERDtree + ctrl+p as well @@ -347,9 +349,10 @@ let g:ctrlp_map = 't' let g:ctrlp_switch_buffer = 0 " easier split screens let g:ctrlp_working_path_mode = 0 " dont try to change my working directory let g:ctrlp_max_height = 12 -let g:ctrlp_custom_ignore = { 'dir': '\v[\/](\.git|\.hg|\.svn|node_modules|\.sass-cache)$', - \ 'file': '\.exe$\|\.so$\|\.dll$\|\.psd$\|\.png$\|\.jpg$\|\.gif$', - \ } +let g:ctrlp_custom_ignore = { + \ 'dir': '\v[\/](\.git|\.hg|\.svn|node_modules|\.sass-cache)$', + \ 'file': '\v\.(exe|so|dll|zip|gz|png|gif|jpg|tif|psd|pdf|mp4|webm|mp3)$', + \ } " Gist filetype-detection let g:gist_detect_filetype = 1 @@ -362,6 +365,12 @@ let g:airline_left_sep='▶' let g:airline_right_sep='◀' set ttimeoutlen=50 +" Mac Dash.app integration +nmap d DashSearch +nmap D DashGlobalSearch +let g:dash_map = { + \ 'javascript' : 'jquery' + \ } " ========== Custom Pseudofunctions ========== diff --git a/zshrc b/zshrc index c559c28..64cd651 100644 --- a/zshrc +++ b/zshrc @@ -2,111 +2,27 @@ ZSH=$HOME/.oh-my-zsh ZSH_THEME="webgefrickel" + # default plugins to load plugins=(brew git git-flow github history-substring-search jake-node npm node gem osx zsh-syntax-highlighting) + source $ZSH/oh-my-zsh.sh unsetopt correct_all -# Terminal -export TERM="screen-256color" - -# brew CASK -# export HOMEBREW_CASK_OPTS="--appdir=/Applications" - -# paths -export PATH=/usr/local/bin:/usr/local/sbin:$HOME/.rvm/bin:$PATH -export MANPATH=/usr/local/share/man:$MANPATH - -# disable stupid ._ and dsstore files -export COPY_EXTENDED_ATTRIBUTES_DISABLE=true -export COPYFILE_DISABLE=true -# editor -export EDITOR=vim -export VISUAL=vim +# Load the shell dotfiles, and then some: +# * ~/.path can be used to extend `$PATH`. +# * ~/.extra can be used for other settings you don’t want to commit. +for file in ~/.{exports,aliases,functions}; do + [ -r "$file" ] && source "$file" +done +unset file -# node.js -export NODE_PATH=/usr/local/lib/jsctags/:$NODE_PATH - -# disable auto titling fixes tmux window -export DISABLE_AUTO_TITLE=true # z script installed via homebrew . `brew --prefix`/etc/profile.d/z.sh -### aliases ## - -# aliases for apache and mysql -alias apachestart='_ /usr/sbin/apachectl start' -alias apachestop='_ /usr/sbin/apachectl stop' -alias mysqlstart='mysql.server start' -alias mysqlstop='mysql.server stop' -alias dev='apachestart && mysqlstart' -alias devs='apachestop && mysqlstop' -alias devr='devs && dev' - -# random usefull stuff -alias dnsflush='_ dscacheutil -flushcache' -alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" - -# all in one homebrew, gem update commands -alias brewup='brew update && brew upgrade && brew cleanup && brew linkapps' -alias gemup='gem update --system && gem update && gem cleanup' -alias npmup='npm -g cache clean && npm -g update' -alias rvmup='rvm get latest' -alias upall='brewup && rvmup && gemup && npmup' - -# always use mvim but for 'vim' -alias v='vim' -alias vd='vimdiff' -alias diff='vimdiff' - -# easy hosts / apache / php editing -alias hosts='_ vim /etc/hosts' -alias vhosts='_ vim /etc/apache2/extra/httpd-vhosts.conf' -alias phpini='vim /usr/local/etc/php/5.4/php.ini' - -# Easier navigation: .., ..., ~ and - -alias ..='cd ..' -alias ...='cd ../..' -alias ....='cd ../../..' -alias .....='cd ../../../..' -alias l='ls -al' -alias e='exit' - -# Shortcuts -alias drop='cd ~/Dropbox && ls -al' -alias web='cd ~/Sites && ls -al' -alias rep='cd ~/Repositories && ls -al' -alias dot='cd ~/Dotfiles && ls -al' -alias brain='cd ~/Dropbox/Brain && vim .' -alias jake='noglob jake' - -# some function for finding stuff -function fname() { find . -iname "*$@*"; } -function grepkill() { ps -axf | grep -v grep | grep "$@" | awk '{print $2}' | xargs kill } - -# Gitty gitgit -alias gitrm='git rm $(git ls-files --deleted)' -alias gsmu='git submodule init && git submodule update' -# THIS is evil. only use for private stuff and useless stuff -# squish those commits afterwards with rebase! -alias ggg='git add . && git commit -a -m "-"' - - -# dandelion deployment shortcuts -alias deploy='dandelion deploy' -alias status='dandelion status' - -# grunt -alias gr='grunt' -alias grw='grunt watch' -alias grd='grunt deploy' - -# other tools -alias t='tmux -u -2' -alias ta='tmux attach' -# rvm ftw! +# rvm TODO use rbenv in the future [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"