Skip to content

Instantly share code, notes, and snippets.

@MQuy
Last active October 18, 2017 06:23
Show Gist options
  • Save MQuy/010ab56c99cf48b994b0 to your computer and use it in GitHub Desktop.
Save MQuy/010ab56c99cf48b994b0 to your computer and use it in GitHub Desktop.
Vim Config
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
let mapleader = "\<Space>"
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'scrooloose/nerdtree'
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <C-e> :NERDTreeToggle<CR>
let NERDTreeNaturalSort = 1
Bundle 'ctrlpvim/ctrlp.vim'
Bundle 'tacahiroy/ctrlp-funky'
Bundle 'FelikZ/ctrlp-py-matcher'
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor,*/publish/*,*/dist/*,*/node_modules/*,*/bower_modules/*,*/tmp/*,*.so,*.swp,*.zip,*.swo,*.DS_Store
nmap <leader>o :CtrlP<cr>
nmap <leader>c :CtrlPClearCache<cr>
let g:ctrlp_working_path_mode = 'ra'
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --ignore ''.git'' --ignore ''.DS_Store'' --ignore ''node_modules'' --ignore ''bower_modules'' --hidden -g ""'
endif
let g:ctrlp_max_files = 0
Bundle 'easymotion/vim-easymotion'
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
Bundle 'rking/ag.vim'
Bundle 'tpope/vim-surround'
Bundle 'ngmy/vim-rubocop'
let g:vimrubocop_keymap = 0
nmap <Leader>ru :RuboCop<CR>
Bundle 'terryma/vim-multiple-cursors'
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
Bundle 'scrooloose/nerdcommenter'
let g:NERDSpaceDelims = 2
let g:NERDCompactSexyComs = 2
let g:NERDDefaultAlign = 'left'
let g:NERDTrimTrailingWhitespace = 1
Bundle 'tpope/vim-rails'
Plugin 'thoughtbot/vim-rspec'
map <leader>rt :call RunCurrentSpecFile()<cr>
map <leader>rr :call RunNearestSpec()<cr>
map <leader>ra :call RunAllSpecs()<cr>
map <leader>rl :call RunLastSpec()<cr>
let g:rspec_command = 'call Send_to_Tmux("rspec {spec}\n")'
let g:rspec_runner = "os_x_iterm"
Bundle 'junegunn/vim-easy-align'
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
Bundle 'jiangmiao/auto-pairs'
Bundle 'tpope/vim-fugitive'
Bundle 'jgdavey/tslime.vim'
nmap <leader>gda :call Send_to_Tmux("rake docs:generate\n")<CR>
nmap <leader>gdf :call Send_to_Tmux("rake docs:generate:append[" . expand('%:p') . "]\n")<CR>
nmap <leader>gct :call Send_to_Tmux("ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)")<CR>
Bundle 'digitaltoad/vim-pug'
Bundle 'ervandew/supertab'
let g:SuperTabDefaultCompletionType = '<C-n>'
Bundle 'Valloric/YouCompleteMe'
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
Bundle 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger = "<tab>"
Bundle 'elixir-lang/vim-elixir'
Bundle 'slashmili/alchemist.vim'
Bundle 'tpope/vim-dispatch'
Bundle 'posva/vim-vue'
Bundle 'leafgarland/typescript-vim'
Bundle 'bling/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
let g:airline_theme='base16'
Bundle 'MQuy/vim-snippets'
Bundle 'w0rp/ale'
let g:ale_enabled = 0
nmap gl :ALEToggle<cr>
Bundle 'jelera/vim-javascript-syntax'
Bundle 'mxw/vim-jsx'
let g:jsx_ext_required = 0
Bundle 'altercation/vim-colors-solarized'
let g:solarized_termcolors=256
let base16colorspace=256
Bundle 'rakr/vim-one'
Bundle 'blerins/flattown'
Bundle 'w0ng/vim-hybrid'
Bundle 'chriskempson/base16-vim'
Bundle 'chriskempson/vim-tomorrow-theme'
Bundle 'dracula/vim'
Bundle 'morhetz/gruvbox'
syntax on
set background=dark
colorscheme one
call vundle#end()
filetype plugin indent on
nnoremap <Leader>w :w<CR>
nmap <leader>q :q!<cr>
nmap <leader>l :noh<cr>
nmap gj <ESC>g<C-]>
nmap gb <C-T><CR>
nmap gr <ESC>:e#<CR>
set termguicolors
set clipboard=unnamed
set undofile
set undodir=~/.vim/undodir
set autochdir
set expandtab
set tabstop=2
set shiftwidth=2
set smarttab
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines"
set number
set ignorecase
set hlsearch
autocmd BufWritePre * :%s/\s\+$//e
set synmaxcol=200
set nocursorcolumn
set nocursorline
set norelativenumber
syntax sync minlines=256
set ttyfast
set ttyscroll=3
set lazyredraw
nmap <leader>y "+y
nmap <leader>p "+p
nmap <leader>r :e!<CR>
set backspace=indent,eol,start
" Nerdtree auto-close window
function! CheckLeftBuffers()
if tabpagenr('$') == 1
let i = 1
while i <= winnr('$')
if getbufvar(winbufnr(i), '&buftype') == 'help' ||
\ getbufvar(winbufnr(i), '&buftype') == 'quickfix' ||
\ exists('t:NERDTreeBufName') &&
\ bufname(winbufnr(i)) == t:NERDTreeBufName ||
\ bufname(winbufnr(i)) == '__Tag_List__'
let i += 1
else
break
endif
endwhile
if i == winnr('$') + 1
qall
endif
unlet i
endif
endfunction
autocmd BufEnter * call CheckLeftBuffers()
autocmd BufEnter * :syn sync maxlines=500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment