Skip to content

Instantly share code, notes, and snippets.

@he9lin
Created November 28, 2013 00:47
Show Gist options
  • Save he9lin/7685645 to your computer and use it in GitHub Desktop.
Save he9lin/7685645 to your computer and use it in GitHub Desktop.
My vim configuration
set nocompatible " must be the first line
filetype on
filetype indent on
filetype plugin on
call pathogen#infect()
syntax on
" Set color theme
let g:cange_style = 'dark'
colorscheme cange
set guifont=Source\ Code\ Pro:h14
set linespace=2
set number
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{fugitive#statusline()}%{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
set laststatus=2
set tabstop=2
set shiftwidth=2
set expandtab
set guioptions-=T "remove toolbar
set guioptions-=L
set guioptions-=r
set directory=/tmp
let mapleader = ","
" Clean up white spaces
autocmd BufWritePre * :%s/\s\+$//e
" Set color column
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" FuzzyFinder
" -----------------------------------------------------------------------------
function! FufSetIgnore()
let ignorefiles = [ $HOME . "/.gitignore", ".gitignore" ]
let exclude_vcs = '\.(hg|git|bzr|svn|cvs)'
let ignore = '\v\~$'
for ignorefile in ignorefiles
if filereadable(ignorefile)
for line in readfile(ignorefile)
if match(line, '^\s*$') == -1 && match(line, '^#') == -1
let line = substitute(line, '^/', '', '')
let line = substitute(line, '\.', '\\.', 'g')
let line = substitute(line, '\*', '.*', 'g')
let ignore .= '|^' . line
endif
endfor
endif
let ignore .= '|^' . exclude_vcs
let g:fuf_coveragefile_exclude = ignore
let g:fuf_file_exclude = ignore
let g:fuf_dir_exclude = ignore
endfor
endfunction
let g:fuf_file_exclude = '\v\~$|(^|[/\\])vendor[/\\]bundle[/\\]'
" Cmd + T for fuzzyfinder
" nnoremap <C-t> :call FufSetIgnore() <BAR> :FufFile **/<CR>
nnoremap <C-t> :<C-u>FufFile **/<CR>
" RSpec
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" Ruby
map <Leader>m :w\|:!~/.rbenv/shims/ruby %<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment