Skip to content

Instantly share code, notes, and snippets.

@MarcosX
Last active August 29, 2015 14:05
Show Gist options
  • Save MarcosX/c881f5997a2ea44c306a to your computer and use it in GitHub Desktop.
Save MarcosX/c881f5997a2ea44c306a to your computer and use it in GitHub Desktop.
.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set hlsearch
set number
set showmatch
set incsearch
set hidden
set textwidth=0 tabstop=2 shiftwidth=2 softtabstop=2 expandtab
set ruler
set wrap
set dir=/tmp//
set scrolloff=5
set foldmethod=manual
set foldlevelstart=20
set ignorecase
set smartcase
" solarized config
syntax enable
set background=dark
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
" nerdtree config
map <silent> <LocalLeader>nt :NERDTreeToggle<CR>
map <silent> <LocalLeader>nf :NERDTreeFind<CR>
let NERDTreeShowHidden=1
" nerdcommenter config
map <silent> <LocalLeader>cc :NERDComSexyComment<CR>
map <silent> <LocalLeader>cu :NERDComUncommentLine<CR>
" ctrlp
map <silent> <LocalLeader>ff :CtrlP<CR>
map <silent> <LocalLeader>fb :CtrlPBuffer<CR>
map <silent> <LocalLeader>rt :!/usr/bin/ctags -R --exclude=".git\|log\|tmp\|db\|" --extra=+f<CR>
" ag - the silver searcher
map <LocalLeader>aw :Ag '<C-R><C-W>'
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" vim tabs
noremap <silent> <LocalLeader>[ :tabp<CR>
noremap <silent> <LocalLeader>] :tabn<CR>
noremap <silent> <LocalLeader><CR> :tabe<CR>
" tabular
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
" Vimux
map <Leader>rl :wa<CR> :VimuxRunLastCommand<CR>
" vimux ruby tests
map <silent> <LocalLeader>rf :RunRubyFocusedTest<CR>
map <silent> <LocalLeader>rc :RunRubyFocusedContext<CR>
map <silent> <LocalLeader>rb :RunAllRubyTests<CR>
" clean empty spaces
nnoremap <silent> <LocalLeader>ww :%s/\s\+$//<CR>:let @/=''<CR><C-o>
" plugins
" ag
" ctrlp.vim
" matchit.zip
" nerdcommenter
" nerdtree
" supertab
" syntastic
" tabular
" vim-airline
" vim-colors-solarized
" vim-endwise
" vim-fugitive
" vim-rails
" vim-ruby
" vim-sensible
" vim-surround
" vimux
" vimux-ruby-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment