" Make vim more useful set nocompatible " Set syntax highlighting options. set t_Co=256 set background=dark syntax on colorscheme molokai " Enabled later, after Pathogen filetype off " Change mapleader let mapleader="," " Local dirs set backupdir=~/.vim/backups set directory=~/.vim/swaps set undodir=~/.vim/undo " Set some junk set autoindent " Copy indent from last line when starting new line. set backspace=indent,eol,start set cursorline " Highlight current line set diffopt=filler " Add vertical spaces to keep right and left aligned set diffopt+=iwhite " Ignore whitespace changes (focus on code changes) set encoding=utf-8 nobomb " BOM often causes trouble set esckeys " Allow cursor keys in insert mode. set expandtab " Expand tabs to spaces set foldcolumn=4 " Column to show folds set foldenable set foldlevel=2 " set foldlevelstart=2 " Sets `foldlevel` when editing a new buffer set foldmethod=syntax " Markers are used to specify folds. set foldminlines=0 " Allow folding single lines set foldnestmax=3 " Set max fold nesting level set formatoptions= set formatoptions+=c " Format comments set formatoptions+=r " Continue comments by default set formatoptions+=o " Make comment when using o or O from comment line set formatoptions+=q " Format comments with gq set formatoptions+=n " Recognize numbered lists set formatoptions+=2 " Use indent from 2nd line of a paragraph set formatoptions+=l " Don't break lines that are already long set formatoptions+=1 " Break before 1-letter words set gdefault " By default add g flag to search/replace. Add g to toggle. set hidden " When a buffer is brought to foreground, remember undo history and marks. set history=1000 " Increase history from 20 default to 1000 set hlsearch " Highlight searches set ignorecase " Ignore case of searches. set incsearch " Highlight dynamically as pattern is typed. set laststatus=2 " Always show status line set lispwords+=defroutes " Compojure set lispwords+=defpartial,defpage " Noir core set lispwords+=defaction,deffilter,defview,defsection " Ciste core set lispwords+=describe,it " Speclj TDD/BDD set magic " Enable extended regexes. set mouse=a " Enable mouse in all modes. set noerrorbells " Disable error bells. set nojoinspaces " Only insert single space after a '.', '?' and '!' with a join command. set nostartofline " Don't reset cursor to start of line when moving around. set nowrap " Do not wrap lines. set nu " Enable line numbers. set ofu=syntaxcomplete#Complete " Set omni-completion method. set report=0 " Show all changes. set ruler " Show the cursor position set scrolloff=3 " Start scrolling three lines before horizontal border of window. set shiftwidth=2 " The # of spaces for indenting. set shortmess=atI " Don't show the intro message when starting vim. set showmode " Show the current mode. set showtabline=1 " show tab bar. set sidescrolloff=3 " Start scrolling three columns before vertical border of window. set smartcase " Ignore 'ignorecase' if search patter contains uppercase characters. set smarttab " At start of line, inserts shiftwidth spaces, deletes shiftwidth spaces. set softtabstop=2 " Tab key results in 2 spaces set splitbelow " New window goes below set splitright " New windows goes right set suffixes=.bak,~,.swp,.swo,.o,.d,.info,.aux,.log,.dvi,.pdf,.bin,.bbl,.blg,.brf,.cb,.dmg,.exe,.ind,.idx,.ilg,.inx,.out,.toc,.pyc,.pyd,.dll set title " Show the filename in the window titlebar. set ttyfast " Send more characters at a given time. set ttymouse=xterm2 " Set mouse type to xterm. set undofile " Persistent Undo. set visualbell " Use visual bell instead of audible bell (annnnnoying) set wildchar= " Character for CLI expansion (TAB-completion). set wildignore+=*.jpg,*.jpeg,*.gif,*.png,*.gif,*.psd,*.o,*.obj,*.min.js set wildignore+=*/smarty/*,*/vendor/*,*/node_modules/*,*/.git/*,*/.hg/*,*/.svn/*,*/.sass-cache/*,*/log/*,*/tmp/*,*/build/*,*/ckeditor/* set wildmenu " Hitting TAB in command mode will show possible completions above command line. set wildmode=list:longest " Complete only until point of ambiguity. set winminheight=0 "Allow splits to be reduced to a single line. set wrapscan " Searches wrap around end of file " Status Line " hi User1 guibg=#455354 guifg=fg ctermbg=238 ctermfg=fg gui=bold,underline cterm=bold,underline term=bold,underline " hi User2 guibg=#455354 guifg=#CC4329 ctermbg=238 ctermfg=196 gui=bold cterm=bold term=bold " set statusline=[%n]\ %1*%<%.99t%*\ %2*%h%w%m%r%*%y[%{&ff}→%{strlen(&fenc)?&fenc:'No\ Encoding'}]%=%-16(\ L%l,C%c\ %)%P let g:Powerline_symbols = 'fancy' " Speed up viewport scrolling nnoremap 3 nnoremap 3 " Faster split resizing (+,-) if bufwinnr(1) map + + map - - endif " Better split switching (Ctrl-j, Ctrl-k, Ctrl-h, Ctrl-l) map j map k map h map l " Sudo write (,W) noremap W :w !sudo tee % " Remap :W to :w command W w command Wq wq " Better mark jumping (line + col) nnoremap ' ` " Hard to type things imap >> → imap << ← imap ^^ ↑ imap VV ↓ imap aa λ " Toggle show tabs and trailing spaces (,c) set lcs=tab:›\ ,trail:·,eol:¬,nbsp:_ set fcs=fold:- nnoremap c :set nolist! " Clear last search (,qs) map qs :noh " map qs :let @/ = "" " Vim on the iPad if &term == "xterm-ipad" nnoremap vnoremap gV onoremap inoremap `^ inoremap endif " Remap keys for auto-completion, disable arrow keys " I still need these cuz im nub. so nub. " inoremap pumvisible() ? "\" : "\" " inoremap pumvisible() ? "\" : "\" " inoremap pumvisible() ? "\" : "\" " inoremap pumvisible() ? "\" : "\" " inoremap " inoremap " Indent/unident block (,]) (,[) nnoremap ] >i{ nnoremap [ " Paste toggle (,p) set pastetoggle=p map p :set invpaste paste? " NERD Commenter let NERDSpaceDelims=1 let NERDCompactSexyComs=1 let g:NERDCustomDelimiters = { 'racket': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' } } " Buffer navigation (,,) (,]) (,[) (,ls) map , " :map ] :bnext " :map [ :bprev map ls :buffers " Close Quickfix window (,qq) map qq :cclose " Yank from cursor to end of line nnoremap Y y$ " Insert newline map o " Search and replace word under cursor (,*) nnoremap * :%s/\<\>// " Strip trailing whitespace (,ss) function! StripWhitespace () let save_cursor = getpos(".") let old_query = getreg('/') :%s/\s\+$//e call setpos('.', save_cursor) call setreg('/', old_query) endfunction noremap ss :call StripWhitespace () " Save and restore folds " :au BufWinLeave * mkview " :au BufWinEnter * silent loadview " Join lines and restore cursor location (J) nnoremap J mjJ`j " Toggle folds () nnoremap :exe 'silent! normal! '.((foldclosed('.')>0)? 'zMzx' : 'zc') " Fix page up and down map map imap imap " Restore cursor position autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " Emulate bundles, allow plugins to live independantly. Easier to manage. call pathogen#runtime_append_all_bundles() filetype plugin indent on " JSON au BufRead,BufNewFile *.json set ft=json syntax=javascript " Jade au BufRead,BufNewFile *.jade set ft=jade syntax=jade " Common Ruby files au BufRead,BufNewFile Rakefile,Capfile,Gemfile,.autotest,.irbrc,*.treetop,*.tt set ft=ruby syntax=ruby " Nu au BufNewFile,BufRead *.nu,*.nujson,Nukefile setf nu " Coffee Folding au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable " ZSH au BufRead,BufNewFile .zsh_rc,.functions,.commonrc set ft=zsh " CtrlP let g:ctrlp_match_window_bottom = 0 " Show at top of window let g:ctrlp_working_path_mode = 2 " Smart path mode let g:ctrlp_mru_files = 1 " Enable Most Recently Used files feature let g:ctrlp_jump_to_buffer = 2 " Jump to tab AND buffer if already open let g:ctrlp_split_window = 1 " = New Tab " Clojure.vim let g:vimclojure#ParenRainbow = 1 " Enable rainbow parens let g:vimclojure#DynamicHighlighting = 1 " Dynamic highlighting let g:vimclojure#FuzzyIndent = 1 " Names beginning in 'def' or 'with' to be indented as if they were included in the 'lispwords' option " Rainbow Parenthesis nnoremap rp :RainbowParenthesesToggle