Update vimrc and aliases

This commit is contained in:
Michael Campagnaro 2013-07-10 12:13:13 -04:00
parent fa8008bfa9
commit 097a97ded2
3 changed files with 63 additions and 27 deletions

30
vimrc
View File

@ -20,6 +20,7 @@ map <leader>fl :CtrlP lib<cr>
map <leader>fp :CtrlP vendor/plugins<cr> map <leader>fp :CtrlP vendor/plugins<cr>
map <leader>fs :CtrlP spec<cr> map <leader>fs :CtrlP spec<cr>
map <leader>ft :CtrlP test<cr> map <leader>ft :CtrlP test<cr>
nnoremap <silent> <leader>fr :ClearCtrlPCache<cr>\|:CtrlP<cr>
" # gist-vim " # gist-vim
let g:gist_detect_filetype = 1 let g:gist_detect_filetype = 1
@ -84,6 +85,10 @@ set list listchars=tab:»·,trail:·
" Adding this since the esc remap on the 'i' key had a long delay when pressed " Adding this since the esc remap on the 'i' key had a long delay when pressed
set timeoutlen=300 ttimeoutlen=0 set timeoutlen=300 ttimeoutlen=0
" When loading text files, wrap them and don't split up words.
au BufNewFile,BufRead *.txt setlocal wrap
au BufNewFile,BufRead *.txt setlocal lbr
" Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html " Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html
if &term =~ '256color' if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes " Disable Background Color Erase (BCE) so that color schemes
@ -92,6 +97,18 @@ if &term =~ '256color'
set t_ut= set t_ut=
endif endif
" Notes and other helpers
map <Leader>bb :!bundle install<cr>
map <leader>gs :Gstatus<CR>
map <leader>gw :!git add . && git commit -m 'WIP' && git push<cr>
map <leader>nn :sp ~/Dropbox/notes/programming-notes<cr>
map <Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>
map <leader>pn :sp ~/Dropbox/work/redwood/notes/project-notes<cr>
map <leader>rf :CommandTFlush<cr>
" Remove trailing whitespace on save all files.
au BufWritePre * :%s/\s\+$//e
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOM AUTOCMDS " CUSTOM AUTOCMDS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -106,7 +123,7 @@ augroup vimrcEx
autocmd FileType python set sw=2 sts=2 et autocmd FileType python set sw=2 sts=2 et
" Indent p tags " Indent p tags
autocmd FileType html,eruby if g:html_indent_tags !~ '\\|p\>' | let g:html_indent_tags .= '\|p\|li\|dt\|dd' | endif autocmd FileType html,eruby if g:html_indent_tags !~ '\\|p\>' | let g:html_indent_tags .= '\|p\|li\|dt\|dd' | endif
augroup END augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -120,7 +137,7 @@ augroup END
" insert an end tag with <c-e> " insert an end tag with <c-e>
imap <c-e> end imap <c-e> end
" insert a hash rocket with <c-l> " insert a hash rocket with <c-l>
imap <c-l> <space>=><space> imap <c-l> <space>=><space>
" Mapping ESC in insert mode and command mode to double i " Mapping ESC in insert mode and command mode to double i
@ -131,7 +148,7 @@ cmap ii <C-[>
nmap <leader>z <c-z> nmap <leader>z <c-z>
" Quickly edit/reload the vimrc file " Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<cr> nmap <silent> <leader>ev :vsp $MYVIMRC<cr>
nmap <silent> <leader>rv :so $MYVIMRC<cr> nmap <silent> <leader>rv :so $MYVIMRC<cr>
" remap saving and quiting :P " remap saving and quiting :P
@ -144,6 +161,11 @@ nmap <leader>x :x<cr>
:ca W w :ca W w
:ca Q q :ca Q q
command! Q q " Bind :Q to :q
command! Qall qall
" Disable Ex mode
map Q <Nop>
" Map ctrl-movement keys to window switching " Map ctrl-movement keys to window switching
map <c-k> <c-w><Up> map <c-k> <c-w><Up>
map <c-j> <c-w><Down> map <c-j> <c-w><Down>
@ -219,7 +241,7 @@ function! PromoteToLet()
:normal == :normal ==
endfunction endfunction
:command! PromoteToLet :call PromoteToLet() :command! PromoteToLet :call PromoteToLet()
:map <leader>p :PromoteToLet<cr> :map <leader>pp :PromoteToLet<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MAPS TO JUMP TO SPECIFIC COMMAND-T TARGETS AND FILES " MAPS TO JUMP TO SPECIFIC COMMAND-T TARGETS AND FILES

View File

@ -20,7 +20,7 @@ alias cd/='cd /'
alias ls='ls -G' alias ls='ls -G'
alias aliases='vim ~/.dotfiles/zsh/aliases' alias aliases='vim ~/.dotfiles/zsh/aliases'
alias functions='vim ~/.dotfiles/zsh/functions' alias b='bundle'
alias bake='bundle exec rake' alias bake='bundle exec rake'
alias be='bundle exec' alias be='bundle exec'
alias bi='bundle install' alias bi='bundle install'
@ -32,6 +32,23 @@ alias code='cd ~/code'
alias d='cd ~/.dotfiles' alias d='cd ~/.dotfiles'
alias dr='cd ~/Dropbox' alias dr='cd ~/Dropbox'
alias duh='du -csh' alias duh='du -csh'
alias functions='vim ~/.dotfiles/zsh/functions'
alias f='fg'
alias history='fc -l 1'
alias h='heroku'
alias irb='irb --readline -r irb/completion'
alias patch='git format-patch HEAD^ --stdout > patch.diff'
alias reguard='killall -9 ruby ; guard'
alias r='rails'
alias rc='rails console'
alias reload='source ~/.zshrc'
alias tail-logs='heroku logs -t'
alias u='cd ..'
alias v='vim'
alias vi='vim'
alias vimrc='vim ~/.vimrc'
alias zsh='vim ~/.zshrc'
# Git # Git
alias ammend='amend' alias ammend='amend'
@ -54,52 +71,43 @@ alias gds='git diff --stat=160,120'
alias gdw='git diff --color-words' alias gdw='git diff --color-words'
alias gf='git fetch' alias gf='git fetch'
alias gh="source ~/.githelpers && show_git_head" alias gh="source ~/.githelpers && show_git_head"
alias gl="source ~/.githelpers && pretty_git_log" alias gl='gll -25'
alias gll='git ll -25' alias gll="source ~/.githelpers && pretty_git_log"
alias gla='git ll --all' alias gla='gll --all'
alias gmff='git merge -ff-only' alias gmff='git merge --ff-only'
alias gmtheirs='git merge -Xtheirs' alias gmtheirs='git merge -Xtheirs'
alias gp='git push' alias gp='git push'
alias gpf='git push -f' alias gpf='git push -f'
alias gpff='git pull --ff-only' alias gpff='git pull --ff-only'
alias gpl='git pull'
alias gpom='git push origin master' alias gpom='git push origin master'
alias gpr='git pull --rebase' alias gpr='git pull --rebase'
alias gr='git reset' alias gr='git reset'
alias grbm='git rebase master'
alias grc='git rebase --continue' alias grc='git rebase --continue'
alias gre='git remote' alias gre='git remote'
alias gsnapshot='git stash save "snapshot: $(date)" && git stash apply "stash@{0}"' alias gsnapshot='git stash save "snapshot: $(date)" && git stash apply "stash@{0}"'
alias gst='git status' alias gst='git status'
alias gs='git stash' alias gs='git stash'
alias gsa='git stash apply' alias gsa='git stash save'
alias gsd='git stash drop' alias gsd='git stash drop'
alias gsl='git stash list' alias gsl='git stash list'
alias gsp='git stash pop' alias gsp='git stash pop'
alias gx='git reset --hard' alias gx='git reset --hard'
alias history='fc -l 1'
alias irb='irb --readline -r irb/completion'
alias patch='git format-patch HEAD^ --stdout > patch.diff'
alias reguard='killall -9 ruby ; guard'
alias r='rails'
alias rc='rails console'
alias reload='source ~/.zshrc'
alias tail-logs='heroku logs -t'
alias u='cd ..'
alias v='vim'
alias vi='vim'
alias vimrc='vim ~/.vimrc'
alias zsh='vim ~/.zshrc'
# Notes # Notes
alias todo='vim ~/Dropbox/notes/life-todo' alias todo='vim ~/Dropbox/notes/life-todo'
alias wtodo='vim ~/Dropbox/notes/work-todo' alias wtodo='vim ~/Dropbox/work/redwood/notes/work-todo'
alias sharp='vim ~/Dropbox/notes/sharpening-notes' alias sharp='vim ~/Dropbox/notes/sharpening-notes'
alias completion='vim ~/Dropbox/notes/completion-list' alias completion='vim ~/Dropbox/notes/completion-list'
alias powerup='vim ~/code/learning-area/notes/powerup'
alias pnotes='vim ~/Dropbox/notes/programming-notes'
alias wnotes='vim ~/Dropbox/work/redwood/notes/project-notes'
# Projects # Projects
alias projects='cd ~/code/projects' alias projects='cd ~/code/projects'
alias dot='cd ~/code/projects/dotfiles' alias dot='cd ~/code/projects/dotfiles'
alias perks='cd ~/code/work/src/campusperks' alias p='cd ~/code/work/redwood/campusperks'
alias work='cd ~/code/work' alias work='cd ~/code/work'
alias learn='cd ~/code/learning-area' alias learn='cd ~/code/learning-area'
alias current='cd ~/code/learning-area/languages-frameworks/elixir/introducing-elixir/physics' alias current='cd ~/code/learning-area/languages-frameworks/elixir/introducing-elixir/physics'

View File

@ -26,7 +26,7 @@ function git-nuke {
function git-on-master { function git-on-master {
branch=`git_branch_name` branch=`git_branch_name`
git checkout master && git pull --rebase git checkout master && git pull --rebase
git checkout $branch git checkout $branch
git rebase master git rebase master
} }
@ -63,3 +63,9 @@ function google() {
function chrome () { function chrome () {
open -a /Applications/Google\ Chrome.app/ "$1" open -a /Applications/Google\ Chrome.app/ "$1"
} }
# See top 10 bash commands
function hist() {
cat ~/.history|cut -d ';' -f 2- 2>/dev/null| awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
}