Last active
April 8, 2016 22:10
-
-
Save edrpls/8e4006f6c55b5ea923b4 to your computer and use it in GitHub Desktop.
.vimrc
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 nocp | |
set t_Co=256 | |
set shell=bash\ --norc | |
"set runtimepath^=~/.vim/bundle/ctrlp.vim | |
let mapleader = "," | |
"javascript-libraries-syntax.vim | |
let g:used_javascript_libs = 'underscore,jquery,angularjs,angularui' | |
"EditorConfig + fugitive | |
let g:EditorConfig_exclude_patterns = ['fugitive://.*'] | |
"Syntastic | |
let g:syntastic_javascript_checkers = ['eslint'] | |
" Disables HTML checking | |
let g:syntastic_mode_map={ 'mode': 'active', | |
\ 'active_filetypes': [], | |
\ 'passive_filetypes': ['html'] } | |
"vim-jsx | |
let g:jsx_ext_required = 0 | |
let g:LargeFile = 1024 * 1024 * 1.5 | |
" Don't screw up folds when inserting text that might affect them, until | |
" leaving insert mode. Foldmethod is local to the window. | |
autocmd InsertEnter * let w:last_fdm=&foldmethod | setlocal foldmethod=manual | |
autocmd InsertLeave * let &l:foldmethod=w:last_fdm | |
"Remaps arrow keys | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
" vimrc edition | |
nnoremap <leader>ev :vsplit $MYVIMRC<cr> | |
nnoremap <leader>sv :source $MYVIMRC<cr> | |
"fzf | |
" regular search | |
nnoremap <silent> <C-p> :FZF<cr> | |
" open buffers | |
function! s:buflist() | |
redir => ls | |
silent ls | |
redir END | |
return split(ls, '\n') | |
endfunction | |
function! s:bufopen(e) | |
execute 'buffer' matchstr(a:e, '^[ 0-9]*') | |
endfunction | |
nnoremap <silent> <Leader>b :call fzf#run({ | |
\ 'source': reverse(<sid>buflist()), | |
\ 'sink': function('<sid>bufopen'), | |
\ 'options': '+m', | |
\ 'down': len(<sid>buflist()) + 2 | |
\ })<CR> | |
" MRU | |
command! FZFMru call fzf#run({ | |
\ 'source': v:oldfiles, | |
\ 'sink': 'e', | |
\ 'options': '-m -x +s', | |
\ 'down': '40%'}) | |
nnoremap <silent> <Leader>m :FZFMru<CR> | |
" search on open buffers | |
function! s:line_handler(l) | |
let keys = split(a:l, ':\t') | |
exec 'buf' keys[0] | |
exec keys[1] | |
normal! ^zz | |
endfunction | |
function! s:buffer_lines() | |
let res = [] | |
for b in filter(range(1, bufnr('$')), 'buflisted(v:val)') | |
call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val ')) | |
endfor | |
return res | |
endfunction | |
command! FZFLines call fzf#run({ | |
\ 'source': <sid>buffer_lines(), | |
\ 'sink': function('<sid>line_handler'), | |
\ 'options': '--extended --nth=3..', | |
\ 'down': '60%' | |
\}) | |
nmap <leader>/ :FZFLines<CR> | |
"set rtp+=~/.fzf | |
" Clipboard buffer actions | |
vmap <Leader>y "+y | |
nmap <Leader>y "+y | |
vmap <Leader>d "+d | |
nmap <Leader>p "+p | |
nmap <Leader>P "+P | |
vmap <Leader>p "+p | |
vmap <Leader>P "+P | |
" UndoTree map to F5 | |
nnoremap <F5> :UndotreeToggle<cr> | |
" Clear selection map to F11 | |
nnoremap <silent> <F11> :noh<cr> | |
"set paste toggle map to F12 | |
set pastetoggle=<F12> | |
"Airline | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme='molokai' | |
"let g:airline_theme='hybrid_reverse' | |
let g:solarized_termcolors=16 | |
set number | |
set ruler | |
set relativenumber | |
set synmaxcol=1000 | |
syntax enable | |
" Set encoding | |
set encoding=utf-8 | |
" Whitespace stuff | |
"set nowrap | |
set tabstop=8 | |
set shiftwidth=4 | |
set softtabstop=0 | |
set softtabstop=0 | |
set expandtab | |
set smarttab | |
set list listchars=tab:▸\ ,trail:· | |
" Wordwrap | |
set wrap | |
set linebreak | |
set nolist " list disables linebreak | |
set textwidth=0 | |
set wrapmargin=0 | |
"Folders | |
set fdm=marker | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Tab completion | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
" Status bar | |
set laststatus=2 | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
" make userreal tabs | |
au FileType make set noexpandtab | |
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
" md, markdown, and mk are markdown and define buffer-local preview | |
" au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup() | |
" add json syntax highlighting | |
au BufNewFile,BufRead *.json set ft=javascript | |
" au BufRead,BufNewFile *.txt call s:setupWrapping() | |
" Search for selected text, forwards or backwards. | |
vnoremap <silent> * :<C-U> | |
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | |
\gvy/<C-R><C-R>=substitute( | |
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | |
\gV:call setreg('"', old_reg, old_regtype)<CR> | |
vnoremap <silent> # :<C-U> | |
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | |
\gvy?<C-R><C-R>=substitute( | |
\escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | |
\gV:call setreg('"', old_reg, old_regtype)<CR> | |
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) | |
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
" load the plugin and indent settings for the detected filetype | |
filetype plugin indent on | |
" Use modeline overrides | |
set modeline | |
set modelines=10 | |
set background=dark | |
let g:enable_bold_font = 1 | |
" Default color scheme | |
"colorscheme solarized | |
"colorscheme ir_black | |
colorscheme Monokai | |
" Esconde background de texto | |
hi Normal ctermbg=NONE | |
" Directories for swp files | |
set backupdir=~/.vim/backup | |
set directory=~/.vim/tmp | |
if has("persistent_undo") | |
set undodir=~/.vim/undodir/ | |
set undofile | |
endif | |
" Show (partial) command in the status line | |
set showcmd | |
au BufNewFile,BufRead *.ctp setfiletype php | |
" MacVim | |
if has("gui_running") | |
set guioptions=aAce | |
set guioptions-=r | |
" you have to enable 'Use experimental render' in Settingz -> Advanced | |
set transparency=6 | |
endif | |
" Remap for Command-T | |
"noremap <silent> <leader>, :CommandT<CR> | |
"noremap <silent> <leader>. :CommandTBuffer<CR> | |
" transform special characters to their HTML entity and viceversa | |
xnoremap <leader>& :call Entities()<CR> | |
xnoremap <leader>é :call ReverseEntities()<CR> | |
" Fixes delay when using O | |
set timeoutlen=100 | |
"let &t_ti.="\e[?7727h" | |
"let &t_te.="\e[?7727l" | |
"noremap <Esc>O[ <Esc> | |
"noremap! <Esc>O[ <C-c> | |
"No ctrl+w while changing split | |
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> | |
let g:UltiSnipsExpandTrigger="<c-b>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
"NERDtree | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
map <C-n> :NERDTreeToggle<CR> | |
"Use one of the following to define the camel characters. | |
" Stop on capital letters. | |
"let g:camelchar = "A-Z" | |
" Also stop on numbers. | |
"let g:camelchar = "A-Z0-9" | |
" Include '.' for class member, ',' for separator, ';' end-statement, | |
" and <[< bracket starts and "'` quotes. | |
"let g:camelchar = "A-Z0-9.,;:{([`'\"" | |
"nnoremap <silent><C-Left> :<C-u>call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%^','bW')<CR> | |
"nnoremap <silent><C-Right> :<C-u>call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%$','W')<CR> | |
"inoremap <silent><C-Left> <C-o>:call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%^','bW')<CR> | |
"inoremap <silent><C-Right> <C-o>:call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%$','W')<CR> | |
"vnoremap <silent><C-Left> :<C-U>call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%^','bW')<CR>v`>o | |
"vnoremap <silent><C-Right> <Esc>`>:<C-U>call search('\C\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%$','W')<CR>v`<o | |
augroup load_us_ycm | |
autocmd! | |
autocmd InsertEnter * call plug#load('ultisnips', 'YouCompleteMe') | |
\| call youcompleteme#Enable() | autocmd! load_us_ycm | |
augroup END | |
call plug#begin('~/.vim/plugged') | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-repeat' | |
Plug 'rking/ag.vim' | |
Plug 'SirVer/ultisnips', { 'on': [] } | Plug 'honza/vim-snippets' | |
Plug 'Valloric/YouCompleteMe', { 'on': [] } | |
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'} | |
Plug 'othree/html5.vim' | |
Plug 'othree/yajs.vim' | |
Plug 'digitaltoad/vim-jade' | |
Plug 'Yggdroot/indentLine' | |
Plug 'marijnh/tern_for_vim' | |
Plug 'juvenn/mustache.vim' | |
Plug 'scrooloose/syntastic' | |
Plug 'scrooloose/nerdtree' | |
Plug 'bling/vim-airline' | |
Plug 'tomtom/tlib_vim' | |
Plug 'matthewsimo/angular-vim-snippets' | |
Plug 'burnettk/vim-angular' | |
Plug 'ap/vim-css-color' | |
Plug 'unblevable/quick-scope' | |
Plug 'cakebaker/scss-syntax.vim' | |
Plug 'mattn/emmet-vim' | |
Plug 'pangloss/vim-javascript' | |
Plug 'mxw/vim-jsx' | |
Plug 'dag/vim-fish' | |
Plug 'fatih/vim-go' | |
Plug 'mbbill/undotree' | |
Plug 'vim-scripts/LargeFile' | |
Plug 'chooh/brightscript.vim' | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'jelera/vim-javascript-syntax', {'autoload':{'filetypes':['javascript']}} | |
Plug 'junegunn/vim-emoji' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
call plug#end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment