Commit 81a3236
Changed files (1)
vimrc
@@ -1,3 +1,394 @@
execute pathogen#infect()
-syntax on
-filetype plugin indent on
+""
+"" Basic Setup
+""
+
+set nocompatible " Use vim, no vi defaults
+set number " Show line numbers
+set ruler " Show line and column number
+syntax enable " Turn on syntax highlighting allowing local overrides
+set encoding=utf-8 " Set default encoding to UTF-8
+
+""
+"" Whitespace
+""
+
+set nowrap " don't wrap lines
+set tabstop=2 " a tab is two spaces
+set shiftwidth=2 " an autoindent (with <<) is two spaces
+set expandtab " use spaces, not tabs
+set list " Show invisible characters
+set backspace=indent,eol,start " backspace through everything in insert mode
+
+" List chars
+set listchars="" " Reset the listchars
+set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
+set listchars+=trail:. " show trailing spaces as dots
+set listchars+=extends:> " The character to show in the last column when wrap is
+ " off and the line continues beyond the right of the screen
+set listchars+=precedes:< " The character to show in the last column when wrap is
+ " off and the line continues beyond the left of the screen
+""
+"" Searching
+""
+
+set hlsearch " highlight matches
+set incsearch " incremental searching
+set ignorecase " searches are case insensitive...
+set smartcase " ... unless they contain at least one capital letter
+
+""
+"" Wild settings
+""
+
+" TODO: Investigate the precise meaning of these settings
+" set wildmode=list:longest,list:full
+
+" Disable output and VCS files
+set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
+
+" Disable archive files
+set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
+
+" Ignore bundler and sass cache
+set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
+
+" Ignore rails temporary asset caches
+set wildignore+=*/tmp/cache/assets/*/sprockets/*,*/tmp/cache/assets/*/sass/*
+
+" Disable temp and backup files
+set wildignore+=*.swp,*~,._*
+
+""
+"" Backup and swap files
+""
+
+set backupdir^=~/.vim/_backup// " where to put backup files.
+set directory^=~/.vim/_temp// " where to put swap files.
+
+""
+"" Helpers
+""
+
+" Some file types should wrap their text
+function! s:setupWrapping()
+ set wrap
+ set linebreak
+ set textwidth=72
+ set nolist
+endfunction
+
+""
+"" File types
+""
+
+filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
+
+if has("autocmd")
+ " In Makefiles, use real tabs, not tabs expanded to spaces
+ au FileType make setlocal noexpandtab
+
+ " This actually might be confusing, but the plugin +ruby+ already does
+ " this, so we want to do it only if the plugin +ruby+ is disabled for
+ " some reason
+ if janus#is_plugin_disabled("ruby")
+ " Set the Ruby filetype for a number of common Ruby files without .rb
+ au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,Procfile,Guardfile,config.ru,*.rake} set ft=ruby
+ endif
+
+ " Make sure all mardown files have the correct filetype set and setup wrapping
+ au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown
+ au FileType markdown call s:setupWrapping()
+
+ " Treat JSON files like JavaScript
+ au BufNewFile,BufRead *.json set ft=javascript
+
+ " make Python follow PEP8 for whitespace ( http://www.python.org/dev/peps/pep-0008/ )
+ au FileType python setlocal softtabstop=4 tabstop=4 shiftwidth=4
+
+ " Remember last location in file, but not for commit messages.
+ " see :help last-position-jump
+ au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
+ \| exe "normal! g`\"" | endif
+endif
+
+""
+"" General Mappings (Normal, Visual, Operator-pending)
+""
+
+" Toggle paste mode
+nmap <silent> <F4> :set invpaste<CR>:set paste?<CR>
+imap <silent> <F4> <ESC>:set invpaste<CR>:set paste?<CR>
+
+" format the entire file
+nnoremap <leader>fef :normal! gg=G``<CR>
+
+" upper/lower word
+nmap <leader>u mQviwU`Q
+nmap <leader>l mQviwu`Q
+
+" upper/lower first char of word
+nmap <leader>U mQgewvU`Q
+nmap <leader>L mQgewvu`Q
+
+" cd to the directory containing the file in the buffer
+nmap <silent> <leader>cd :lcd %:h<CR>
+
+" Create the directory containing the file in the buffer
+nmap <silent> <leader>md :!mkdir -p %:p:h<CR>
+
+" Some helpers to edit mode
+" http://vimcasts.org/e/14
+nmap <leader>ew :e <C-R>=expand('%:h').'/'<cr>
+nmap <leader>es :sp <C-R>=expand('%:h').'/'<cr>
+nmap <leader>ev :vsp <C-R>=expand('%:h').'/'<cr>
+nmap <leader>et :tabe <C-R>=expand('%:h').'/'<cr>
+
+" Swap two words
+nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
+
+" Underline the current line with '='
+nmap <silent> <leader>ul :t.<CR>Vr=
+
+" set text wrapping toggles
+nmap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
+
+" find merge conflict markers
+nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
+
+" Map the arrow keys to be based on display lines, not physical lines
+map <Down> gj
+map <Up> gk
+
+" Toggle hlsearch with <leader>hs
+nmap <leader>hs :set hlsearch! hlsearch?<CR>
+
+" Adjust viewports to the same size
+map <Leader>= <C-w>=
+
+if has("gui_macvim") && has("gui_running")
+ " Map command-[ and command-] to indenting or outdenting
+ " while keeping the original selection in visual mode
+ vmap <D-]> >gv
+ vmap <D-[> <gv
+
+ nmap <D-]> >>
+ nmap <D-[> <<
+
+ omap <D-]> >>
+ omap <D-[> <<
+
+ imap <D-]> <Esc>>>i
+ imap <D-[> <Esc><<i
+
+ " Bubble single lines
+ nmap <D-Up> [e
+ nmap <D-Down> ]e
+ nmap <D-k> [e
+ nmap <D-j> ]e
+
+ " Bubble multiple lines
+ vmap <D-Up> [egv
+ vmap <D-Down> ]egv
+ vmap <D-k> [egv
+ vmap <D-j> ]egv
+
+ " Map Command-# to switch tabs
+ map <D-0> 0gt
+ imap <D-0> <Esc>0gt
+ map <D-1> 1gt
+ imap <D-1> <Esc>1gt
+ map <D-2> 2gt
+ imap <D-2> <Esc>2gt
+ map <D-3> 3gt
+ imap <D-3> <Esc>3gt
+ map <D-4> 4gt
+ imap <D-4> <Esc>4gt
+ map <D-5> 5gt
+ imap <D-5> <Esc>5gt
+ map <D-6> 6gt
+ imap <D-6> <Esc>6gt
+ map <D-7> 7gt
+ imap <D-7> <Esc>7gt
+ map <D-8> 8gt
+ imap <D-8> <Esc>8gt
+ map <D-9> 9gt
+ imap <D-9> <Esc>9gt
+else
+ " Map command-[ and command-] to indenting or outdenting
+ " while keeping the original selection in visual mode
+ vmap <A-]> >gv
+ vmap <A-[> <gv
+
+ nmap <A-]> >>
+ nmap <A-[> <<
+
+ omap <A-]> >>
+ omap <A-[> <<
+
+ imap <A-]> <Esc>>>i
+ imap <A-[> <Esc><<i
+
+ " Bubble single lines
+ nmap <C-Up> [e
+ nmap <C-Down> ]e
+ nmap <C-k> [e
+ nmap <C-j> ]e
+
+ " Bubble multiple lines
+ vmap <C-Up> [egv
+ vmap <C-Down> ]egv
+ vmap <C-k> [egv
+ vmap <C-j> ]egv
+
+ " Make shift-insert work like in Xterm
+ map <S-Insert> <MiddleMouse>
+ map! <S-Insert> <MiddleMouse>
+
+ " Map Control-# to switch tabs
+ map <C-0> 0gt
+ imap <C-0> <Esc>0gt
+ map <C-1> 1gt
+ imap <C-1> <Esc>1gt
+ map <C-2> 2gt
+ imap <C-2> <Esc>2gt
+ map <C-3> 3gt
+ imap <C-3> <Esc>3gt
+ map <C-4> 4gt
+ imap <C-4> <Esc>4gt
+ map <C-5> 5gt
+ imap <C-5> <Esc>5gt
+ map <C-6> 6gt
+ imap <C-6> <Esc>6gt
+ map <C-7> 7gt
+ imap <C-7> <Esc>7gt
+ map <C-8> 8gt
+ imap <C-8> <Esc>8gt
+ map <C-9> 9gt
+ imap <C-9> <Esc>9gt
+endif
+
+""
+"" Command-Line Mappings
+""
+
+" After whitespace, insert the current directory into a command-line path
+cnoremap <expr> <C-P> getcmdline()[getcmdpos()-2] ==# ' ' ? expand('%:p:h') : "\<C-P>"
+
+" Kills Trailing Whitespaces
+command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
+
+if has("statusline") && !&cp
+ set laststatus=2 " always show the status bar
+
+ " Start the status line
+ set statusline=%f\ %m\ %r
+ set statusline+=Line:%l/%L[%p%%]
+ set statusline+=Col:%v
+ set statusline+=Buf:#%n
+ set statusline+=[%b][0x%B]
+endif
+
+" vimrc.after
+color ir_black
+
+set completefunc=syntaxcomplete#Complete
+
+set nocompatible
+set modelines=0
+set encoding=utf-8
+set scrolloff=3
+set incsearch
+set ignorecase smartcase
+set hlsearch
+set autoindent
+set gdefault
+set showmatch
+set ruler
+set laststatus=2
+set showcmd
+set showmode
+set hidden
+set wildmenu
+set wildmode=list:longest
+set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/coverage/*
+set cursorline
+set ttyfast
+set backspace=indent,eol,start
+set number
+set visualbell
+set exrc " enable per-directory .vimrc files
+set secure " disable unsafe commands in local .vimrc files
+"set backupdir=~/tmp
+set nobackup
+set nowritebackup
+if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
+ set t_Co=256
+endif
+
+let mapleader = ","
+let localleader = "\\"
+
+nnoremap <leader>ev :vsplit $MYVIMRC.after<cr>
+nnoremap <leader>sv :source $MYVIMRC.after<cr>
+nnoremap <leader><space> :noh<cr>
+nnoremap <tab> %
+vnoremap <tab> %
+nnoremap ; :
+nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
+nnoremap <leader>v <C-w>v<C-w>l
+nnoremap <leader>h <C-w>s<C-w>l
+nnoremap <C-h> <C-w>h
+nnoremap <C-j> <C-w>j<C-w>_
+nnoremap <C-k> <C-w>k<C-w>_
+nnoremap <C-l> <C-w>l
+nnoremap <leader>p "+p
+nnoremap <leader>n :NERDTreeFind<cr>
+nnoremap <leader>t :!rspec %<cr>
+nnoremap <space> za
+vnoremap <space> zf
+
+" surround with "
+nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
+nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
+" move to start of line
+nnoremap H ^
+" move to end of line
+nnoremap L $
+" escape
+inoremap jk <esc>
+" inoremap <esc> <nop>
+nnoremap <C-e> :e#<cr>
+
+" abbreviations
+iabbrev adn and
+iabbrev waht what
+iabbrev teh the
+iabbrev tehn then
+iabbrev @@ mo@mokhan.ca
+
+au FocusLost * :w
+autocmd BufNewFile *.rb :write
+autocmd BufWritePre,BufRead *.html :normal gg=G
+autocmd BufNewFile,BufRead *.html setlocal nowrap
+" \c comment out line.
+autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
+autocmd FileType python nnoremap <buffer> <localleader>c I#<esc>
+autocmd FileType ruby nnoremap <buffer> <localleader>c I#<esc>
+autocmd FileType html nnoremap <buffer> <localleader>c I<!--<esc>A--><esc>
+
+" turn on spell checker
+autocmd FileType markdown nnoremap setlocal spell
+
+autocmd FileType html :iabbrev <buffer> ' ’
+
+let g:ctrlp_map = '<leader>t'
+let g:ctrlp_match_window_bottom = 0
+let g:ctrlp_match_window_reversed = 0
+let g:ctrlp_custom_ignore = {
+ \ 'dir': '\v[\/]\.(git|hg|svn|bzr)$',
+ \ 'file': '\v\.(exe|so|dll|swp|wav|mp3|mp4|ogg|pdf|png|jpg|jpeg|bmp|m3u|img|rtf|log|iso|deb|run|part|pls|m4r|ogv|mov|avi|nfo|doc|docx|epub|nfo|m4v|tax|pptx|ini|db|3gp|sfv)$',
+ \ }
+let g:ctrlp_working_path_mode = 0
+let g:ctrlp_dotfiles = 0
+let g:ctrlp_switch_buffer = 0