Last active
November 20, 2015 19:39
-
-
Save gtcarlos/c8becafe5f7265434e61 to your computer and use it in GitHub Desktop.
20/11/2015 Vim Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
let mapleader="," | |
" Vundle | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' " Required | |
" Vim Plugins | |
"" Ruby on Rails | |
Plugin 'tpope/vim-rails' | |
Plugin 'tpope/vim-rake' | |
Plugin 'vim-ruby/vim-ruby' | |
Plugin 'avakhov/vim-yaml' | |
Plugin 'ecomba/vim-ruby-refactoring' | |
Plugin 'tpope/vim-haml' | |
Plugin 'rorymckinley/vim-rubyhash' | |
Plugin 'stefanoverna/vim-i18n' | |
Plugin 'danchoi/ri.vim' | |
Plugin 'gabebw/vim-spec-runner' | |
Plugin 'AndrewRadev/switch.vim' | |
"" Javascript | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'kchmck/vim-coffee-script' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'mustache/vim-mustache-handlebars' | |
Plugin 'walm/jshint.vim' | |
Plugin 'maksimr/vim-jsbeautify' | |
Plugin 'elzr/vim-json' | |
Plugin 'itspriddle/vim-jquery' | |
Plugin 'dsawardekar/ember.vim' | |
Plugin 'heartsentwined/vim-emblem' | |
"" Git | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'dockyard/vim-easydir' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'wellle/targets.vim' | |
Plugin 'wakatime/vim-wakatime' | |
Plugin 'ervandew/supertab' | |
Plugin 'bling/vim-airline' | |
Plugin 'szw/vim-ctrlspace' | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'bronson/vim-trailing-whitespace' | |
Plugin 'mattn/gist-vim' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'tpope/vim-abolish' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'gregsexton/gitv' | |
Plugin 'gabrielelana/vim-markdown' | |
Plugin 'henrik/vim-indexed-search' | |
Plugin 'vim-scripts/LargeFile' | |
Plugin 'skwp/greplace.vim' | |
Plugin 'chriskempson/base16-vim' | |
Plugin 'AndrewRadev/splitjoin.vim' | |
Plugin 'idanarye/vim-merginal' | |
Plugin 'godlygeek/tabular' | |
Plugin 'vim-scripts/delimitMate.vim' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'othree/html5.vim' | |
Plugin 'hokaccha/vim-html5validator' | |
Plugin 'ggreer/the_silver_searcher' | |
Plugin 'alvan/vim-closetag' | |
Plugin 'othree/xml.vim' | |
Plugin 'chase/vim-ansible-yaml' | |
call vundle#end() | |
filetype plugin indent on | |
set autoindent | |
set encoding=utf-8 | |
set nu | |
set textwidth=80 | |
set title | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set backspace=indent,eol,start | |
set hidden | |
set noswapfile | |
set nobackup | |
" Syntax | |
syntax on | |
set t_Co=256 | |
" Files | |
filetype on | |
filetype indent on | |
filetype plugin on | |
" Always show filename | |
set modeline | |
set ls=2 | |
" Colorscheme | |
" Change colors/molokai.vim to fix match parenthesis disappearing | |
" hi MatchParen ctermfg=197 ctermbg=NONE cterm=bold | |
set background=dark | |
colorscheme molokai | |
let g:molokai_original = 1 | |
" Vim splits remap | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Vim scroll remap | |
map <C-J> <PageDown> | |
map <C-K> <PageUp> | |
" A trick for when you forgot to sudo before editing a file that requires root | |
" privileges (typically /etc/hosts). | |
" " This lets you use w!! to do that after you opened the file already: | |
cmap w!! w !sudo tee % >/dev/null | |
" CtrlSpace | |
let g:airline_exclude_preview = 1 | |
hi CtrlSpaceSelected term=reverse ctermfg=187 ctermbg=23 cterm=bold | |
hi CtrlSpaceNormal term=NONE ctermfg=244 ctermbg=232 cterm=NONE | |
hi CtrlSpaceFound ctermfg=220 ctermbg=NONE cterm=bold | |
" Buffer mapping | |
:map <D-1> :confirm :b1 <CR> | |
:map <D-2> :confirm :b2 <CR> | |
:map <D-3> :confirm :b3 <CR> | |
:map <D-4> :confirm :b4 <CR> | |
:map <D-5> :confirm :b5 <CR> | |
:map <D-6> :confirm :b6 <CR> | |
:map <D-7> :confirm :b7 <CR> | |
:map <D-8> :confirm :b8 <CR> | |
:map <D-9> :confirm :b9 <CR> | |
" cycle through buffers with <ALT><Left> and <ALT><Right> | |
:nmap <D-Left> :bprev<CR> | |
:nmap <D-Right> :bnext<CR> | |
" Airline | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_powerline_fonts = 1 | |
" CtrlP | |
map <C-B> :CtrlPBuffer<CR>" | |
" NERDTree | |
map <C-n> :NERDTreeToggle<CR> | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
" CtrlP + Ag | |
if executable('ag') | |
" 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 ""' | |
endif | |
" XML | |
let g:xml_syntax_folding=1 | |
au FileType xml setlocal foldmethod=syntax | |
function! DoPrettyXML() | |
let l:origft = &ft | |
set ft= | |
1s/<?xml .*?>//e | |
0put ='<PrettyXML>' | |
$put ='</PrettyXML>' | |
silent %!xmllint --format - | |
2d | |
$d | |
silent %< | |
1 | |
exe "set ft=" . l:origft | |
endfunction | |
command! PrettyXML call DoPrettyXML() | |
function! WrapForTmux(s) | |
if !exists('$TMUX') | |
return a:s | |
endif | |
let tmux_start = "\<Esc>Ptmux;" | |
let tmux_end = "\<Esc>\\" | |
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end | |
endfunction | |
let &t_SI .= WrapForTmux("\<Esc>[?2004h") | |
let &t_EI .= WrapForTmux("\<Esc>[?2004l") | |
" Remove trailing space | |
autocmd BufWritePre * :%s/\s\+$//e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment