Skip to content

Instantly share code, notes, and snippets.

@nicalpi
Created July 5, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicalpi/2386ce9b6de1932aab34 to your computer and use it in GitHub Desktop.
Save nicalpi/2386ce9b6de1932aab34 to your computer and use it in GitHub Desktop.
current vimrc
set nocompatible
command! W :w
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle'
Plugin 'tpope/vim-sensible.git'
Plugin 'vim-scripts/YankRing.vim.git'
Plugin 'mileszs/ack.vim.git'
Plugin 'jayferd/eco.vim.git'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
Plugin 'juvenn/mustache.vim.git'
Plugin 'scrooloose/nerdtree.git'
Plugin 'vim-scripts/ruby-matchit.git'
Plugin 'ervandew/supertab.git'
Plugin 'godlygeek/tabular.git'
Plugin 'MarcWeber/vim-addon-mw-utils.git'
Plugin 'vim-scripts/bufexplorer.zip.git'
Plugin 'kchmck/vim-coffee-script.git'
Plugin 'tpope/vim-cucumber.git'
Plugin 'tpope/vim-endwise.git'
Plugin 'tpope/vim-fugitive.git'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-haml.git'
Plugin 'henrik/vim-indexed-search.git'
Plugin 'tpope/vim-markdown.git'
Plugin 'edsono/vim-matchit.git'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-rails.git'
Plugin 'tpope/vim-repeat.git'
Plugin 'vim-ruby/vim-ruby.git'
Plugin 'tpope/vim-rvm.git'
Plugin 'tomtom/tlib_vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'tpope/vim-surround.git'
Plugin 'tpope/vim-unimpaired.git'
Plugin 'kana/vim-textobj-user'
Plugin 'nelstrom/vim-textobj-rubyblock.git'
Plugin 'kien/ctrlp.vim.git'
Plugin 'tacahiroy/ctrlp-funky'
Plugin 'gregsexton/gitv'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter.git'
Plugin 'vim-scripts/Tagbar.git'
Plugin 'nathanaelkane/vim-indent-guides.git'
Plugin 'tpope/vim-dispatch.git'
Plugin 'jgdavey/tslime.vim'
Plugin 'chriskempson/vim-tomorrow-theme'
Plugin 'slim-template/vim-slim.git'
Plugin 'skalnik/vim-vroom'
Plugin 'thoughtbot/vim-rspec'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'raphamorim/lucario'
Plugin 'lsdr/monokai'
Plugin 'altercation/vim-colors-solarized'
Plugin 'benmills/vimux'
call vundle#end()
filetype plugin indent on
runtime macros/matchit.vim
syntax on
set shell=/bin/zsh
highlight Pmenu ctermbg=238 gui=bold
"set background=light
"set term=xterm
set backspace=indent,eol,start
set guioptions= " remove all guioptions
set guioptions=i
set history=1000
set noautowrite " autosave off :next etc
set nobackup
set nowritebackup
set noswapfile
set dir=~/tmp
set modeline
set modelines=8
set pastetoggle=<F2>
set shiftwidth=2
set softtabstop=2
set ts=2
set bs=2
set expandtab
set autoindent
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
set wildmode=list:longest "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set wildignore+=*/.hg/*
set wildignore+=*/.git/*
set list
set nu
set listchars=tab:»·
set listchars+=trail:·
set formatoptions-=o
set scrolloff=3
set sidescrolloff=7
set sidescroll=1
set cpo-=<
set wcm=<C-Z>
set mouse=a
set ttymouse=xterm2
set gfn=Inconsolata-dz\ for\ Powerline\ 12
set guifont=Inconsolata-dz\ for\ Powerline\ 12
set t_Co=256
set laststatus=2
set hidden
set shortmess=atI
set undodir=~/tmp/vim/
syntax enable
set background=dark
"set clipboard=unnamedplus
"colorscheme Tomorrow-Night
colorscheme solarized
let g:SuperTabDefaultCompletionType = "<c-n>"
let g:syntastic_enable_signs=1
let g:indent_guides_guide_size = 1
let mapleader = ","
" We use silversearch as a replacement for ack-grep
let g:ackprg = 'ag --nogroup --nocolor --column'
"let g:ackprg="ack-grep -H --nocolor --nogroup --column"
filetype on
compiler ruby
function! g:ToggleNuMode()
if(&rnu == 1)
set nu
else
set rnu
endif
endfunction
"use the . in VMODE
vnoremap . :norm.<CR>
" Mappings
"map to bufexplorer
nnoremap <C-B> :BufExplorer<CR>
"map to fuzzy finder text mate stylez
nnoremap <c-n> :NERDTreeToggle<CR><CR>
"map Q to something useful
noremap Q gq
nnoremap <C-L> :call g:ToggleNuMode()<cr>
" Edit routes
command! Rroutes :R config/routes.rb
command! RTroutes :RT config/routes.rb
" Edit factories
command! Rfactories :R spec/factories.rb
command! RTfactories :RT spec/factories.rb
vmap D y'>2o<Esc>p
nnoremap / /\v
vnoremap / /\v
" nnoremap ; :
nnoremap <Leader>W :%s/\s\+$//<cr>:let @/=''<CR>
"omnifunc=rubycomplete#Complete is set by rails.vim
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_include_object = 1
autocmd FileType ruby,eruby let g:rubycomplete_include_objectspace = 1
autocmd BufRead,BufNewFile *.html source ~/.vim/indent/html_grb.vim
" Close tags
imap ,/ </<C-X><C-O>
" Tabularize
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
" Align
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
" Ctags
let Tlist_Use_Right_Window = 1
let Tlist_Ctags_Cmd = "/usr/bin/ctags"
let Tlist_WinWidth = 50
map <F4> :TagbarToggle<CR>
" Switch between file and buffers
nmap ## <C-^>
" Clean whitespace on save
autocmd BufWritePre * call StripTrailingWhite()
function! StripTrailingWhite()
let l:winview = winsaveview()
silent! %s/\s\+$//
call winrestview(l:winview)
endfunction
" Moving line up and down
nnoremap <C-S-J> :m+<CR>==
nnoremap <C-S-K> :m-2<CR>==
inoremap <C-S-J> <Esc>:m+<CR>==gi
inoremap <C-S-K> <Esc>:m-2<CR>==gi
vnoremap <C-S-J> :m'>+<CR>gv=gv
vnoremap <C-S-K> :m-2<CR>gv=gv
" Yank Ring
nnoremap <C-F11> :YRShow<CR>
let g:yankring_replace_n_pkey = '<leader>['
let g:yankring_replace_n_nkey = '<leader>]'
" Consitent copy and paste
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
let g:AutoCloseExpandEnterOn = ""
map <leader>r VimuxRunCommand :Rrunner<CR>
" disable arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
"Funcky Ctrl-p
let g:ctrlp_funky_syntax_highlight = 1
nnoremap <Leader>fu :CtrlPFunky<Cr>
" narrow the list down with a word under cursor
nnoremap <Leader>fU :execute 'CtrlPFunky ' . expand('<cword>')<Cr>
" Gvim startup size
if has("gui_running")
" GUI is running or is about to start.
" Maximize gvim window.
set lines=160 columns=150
endif
autocmd FileType cucumber compiler cucumber | setl makeprg=cucumber\ \"%:p\"
autocmd FileType ruby
\ if expand('%') =~# '_test\.rb$' |
\ compiler rubyunit | setl makeprg=testrb\ \"%:p\" |
\ elseif expand('%') =~# '_spec\.rb$' |
\ compiler rspec | setl makeprg=rspec\ \"%:p\" |
\ else |
\ compiler ruby | setl makeprg=ruby\ -wc\ \"%:p\" |
\ endif
autocmd User Bundler
\ if &makeprg !~# 'bundle' | setl makeprg^=bundle\ exec\ | endif
" Make control-p faster
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
" OLD Rspec.vim mappings
"let g:rspec_command = "VimuxRunCommand 'rspec {spec}'"
"map <Leader>t :call RunCurrentSpecFile()<CR>
"map <Leader>s :call RunNearestSpec()<CR>
"map <Leader>l :call RunLastSpec()<CR>
"map <Leader>a :call RunAllSpecs()<CR>
" Now using Vroom
let g:vroom_use_vimux = 1
let g:vroom_map_keys = 0
map <Leader>t :VroomRunTestFile<CR>
map <Leader>s :VroomRunNearestTest<CR>
map <Leader>l :VroomRunLastTest<CR>
let g:airline_powerline_fonts = 1
"UtilSnip
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
"Multiple Cursors
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_next_key='<C-m>'
let g:multi_cursor_prev_key='<C-f>'
let g:multi_cursor_skip_key='<C-s>'
let g:multi_cursor_quit_key='<Esc>'
"ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<C-tab>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment