Created
June 25, 2017 22:22
-
-
Save alduro/288a281e64990fe3f92416f9507a91f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 " be iMproved, required | |
filetype off " required | |
let mapleader = ',' | |
set wildmenu | |
set autoread | |
set encoding=utf-8 | |
" ----- Powerline ---------------------------------- | |
set guifont=Meslo\ LG\ L\ DZ\ for\ Powerline:h14 | |
let g:Powerline_symbols = 'fancy' | |
set encoding=utf-8 | |
set t_Co=256 | |
set fillchars+=stl:\ ,stlnc:\ | |
set term=screen-256color | |
set termencoding=utf-8 | |
set rtp+=~/Library/Python/2.7/lib/python/site-packages/powerline/bindings/vim | |
" ----- Powerline ---------------------------------- | |
set laststatus=2 | |
set showtabline=2 | |
set noshowmode | |
set clipboard=unnamed | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
au! BufWritePost .vimrc so % | |
au! BufWritePost .gvimrc so % | |
au FocusGained * silent redraw! | |
" alternatively, pass a path where Vundle should install plugins | |
" "call vundle#begin('~/some/path/here') | |
" | |
" " let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" | |
" " The following are examples of different formats supported. | |
" " Keep Plugin commands between vundle#begin/end. | |
" " plugin on GitHub repo | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-surround' | |
" Git plugin not hosted on GitHub | |
Plugin 'toggle_comment' | |
Plugin 'rename2' | |
Plugin 'chriskempson/base16-vim' | |
Plugin 'Buffergator' | |
Plugin 'snipMate' | |
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plugin 'junegunn/fzf.vim' | |
Plugin 'Supertab' | |
Plugin 'TagBar' | |
Plugin 'drn/zoomwin-vim' | |
Plugin 'yssl/AutoCWD.vim' | |
Plugin 'dracula/vim' | |
Plugin 'Spacegray.vim' | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'BusyBee' | |
Plugin 'rking/ag.vim' | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'marijnh/tern_for_vim' | |
Plugin 'jbgutierrez/vim-babel' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'othree/yajs.vim' | |
Plugin 'slashmili/alchemist.vim' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'christoomey/vim-tmux-navigator' | |
Plugin 'easymotion/vim-easymotion' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'epilande/vim-es2015-snippets' | |
Plugin 'epilande/vim-react-snippets' | |
Plugin 'SirVer/ultisnips' | |
Plugin 'mhartington/oceanic-next' | |
Plugin 'ElmCast/elm-vim' | |
Plugin 'hlissner/vim-multiedit' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'flowtype/vim-flow' | |
Plugin 'syntastic' | |
Plugin 'szw/vim-tags' | |
" | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype indent on " required | |
" To ignore plugin indent changes, instead use: | |
"filetype plugin on | |
" | |
" Brief help | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just | |
" :PluginUpdate | |
" :PluginSearch foo - searchts for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to | |
" auto-approve removal | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
"default tab settitgs | |
set sw=2 | |
set softtabstop=2 | |
set expandtab | |
set cursorline | |
set number | |
"set relativenumber | |
set showmatch | |
syntax on | |
set shiftwidth=2 | |
set smartindent | |
let g:gruvbox_italic=1 | |
set background=dark | |
colorscheme OceanicNext | |
" If installed using git | |
set rtp+=~/.fzf | |
" Open files in horizontal split | |
nnoremap <silent> <Leader>s :call fzf#run({ | |
\ 'down': '40%', | |
\ 'sink': 'botright split' })<CR> | |
" | |
" Open files in vertical horizontal split | |
nnoremap <silent> <Leader>v :call fzf#run({ | |
\ 'right': winwidth('.') / 2, | |
\ 'sink': 'vertical botright split' })<CR> | |
nnoremap <silent> <Leader>C :call fzf#run({ | |
\ 'source': | |
\ map(split(globpath(&rtp, "colors/*.vim"), "\n"), | |
\ "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')"), | |
\ 'sink': 'colo', | |
\ 'options': '+m', | |
\ 'left': 30 | |
\ })<CR> | |
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><Enter> :call fzf#run({ | |
\ 'source': reverse(<sid>buflist()), | |
\ 'sink': function('<sid>bufopen'), | |
\ 'options': '+m', | |
\ 'down': len(<sid>buflist()) + 2 | |
\ })<CR> | |
nnoremap <silent> <Leader>f :Files <CR> | |
function! s:tags_sink(line) | |
let parts = split(a:line, '\t\zs') | |
let excmd = matchstr(parts[2:], '^.*\ze;"\t') | |
execute 'silent e' parts[1][:-2] | |
let [magic, &magic] = [&magic, 0] | |
execute excmd | |
let &magic = magic | |
endfunction | |
function! s:tags() | |
if empty(tagfiles()) | |
echohl WarningMsg | |
echom 'Preparing tags' | |
echohl None | |
call system('ctags -R') | |
endif | |
call fzf#run({ | |
\ 'source': 'cat '.join(map(tagfiles(), 'fnamemodify(v:val, ":S")')). | |
\ '| grep -v ^!', | |
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --tiebreak=index', | |
\ 'down': '40%', | |
\ 'sink': function('s:tags_sink')}) | |
endfunction | |
command! Tags call s:tags() | |
" | |
" Replace the default dictionary completion with fzf-based fuzzy completion | |
inoremap <expr> <c-x><c-k> fzf#complete('cat /usr/share/dict/words') | |
imap <c-x><c-l> <plug>(fzf-complete-line) | |
" | |
" This is the default extra key bindings | |
let g:fzf_action = { | |
\ 'ctrl-t': 'tab split', | |
\ 'ctrl-x': 'split', | |
\ 'ctrl-v': 'vsplit' } | |
" Default fzf layout | |
" - down / up / left / right | |
let g:fzf_layout = { 'down': '~40%' } | |
" Customize fzf colors to match your color scheme | |
let g:fzf_colors = | |
\ { 'fg': ['fg', 'Normal'], | |
\ 'bg': ['bg', 'Normal'], | |
\ 'hl': ['fg', 'Comment'], | |
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
\ 'hl+': ['fg', 'Statement'], | |
\ 'info': ['fg', 'PreProc'], | |
\ 'prompt': ['fg', 'Conditional'], | |
\ 'pointer': ['fg', 'Exception'], | |
\ 'marker': ['fg', 'Keyword'], | |
\ 'spinner': ['fg', 'Label'], | |
\ 'header': ['fg', 'Comment'] } | |
" | |
" Enable per-command history. | |
" CTRL-N and CTRL-P will be automatically | |
" bound to next-history and | |
" " previous-history instead of down and up. If | |
" you don't like the change, | |
" " explicitly bind the keys to down and up in | |
" your $FZF_DEFAULT_OPTS. | |
let g:fzf_history_dir = '~/.fzf-history' | |
" [Files] Extra options for fzf | |
" e.g. File preview using CodeRay (http://coderay.rubychan.de/) | |
let g:fzf_files_options = | |
\ '--preview "(coderay {} || cat {}) 2> /dev/null | head -'.&lines.'"' | |
" [Buffers] Jump to the existing window if possible | |
let g:fzf_buffers_jump = 1 | |
" [[B]Commits] Customize the options used by 'git log': | |
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' | |
" [Tags] Command to generate tags file | |
let g:fzf_tags_command = 'ctags -R' | |
" [Commands] --expect expression for directly executing the command | |
let g:fzf_commands_expect = 'alt-enter,ctrl-x' | |
let g:javascript_plugin_jsdoc = 1 | |
" These are the tweaks I apply to YCM's | |
" config, you don't need them but they | |
" might help. | |
" YCM gives you popups and splits by default | |
" that some people might not like, | |
" so these should tidy it up a bit for you. | |
let g:ycm_add_preview_to_completeopt=0 | |
let g:ycm_confirm_extra_conf=0 | |
set completeopt-=preview | |
" | |
" Configure syntastic | |
"set statusline+=%#warningmsg# | |
"set statusline+=%{SyntasticStatuslineFlag()} | |
"set statusline+=%* | |
let g:syntastic_javascript_checkers = ['eslint'] | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_loc_list_height = 5 | |
let g:syntastic_auto_loc_list = 2 | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_check_on_wq = 0 | |
let local_eslint = finddir('node_modules', '.;') . '/.bin/eslint' | |
if matchstr(local_eslint, "^\/\\w") == '' | |
let local_eslint = getcwd() . "/" . local_eslint | |
endif | |
if executable(local_eslint) | |
let g:syntastic_javascript_eslint_exec = local_eslint | |
endif | |
" | |
let g:syntastic_enable_elixir_checker = 1 | |
let g:syntastic_disabled_filetypes=['html_tidy', 'sass'] | |
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute " ,"trimming empty <", "unescaped &" , "lacks \"action", "is not recognized!", "discarding unexpected", "missing", "inserting implicit"] | |
" | |
" | |
"Buffers | |
:nnoremap <C-b> :bnext<CR> | |
":nnoremap <S-Tab> :bprevious<CR> | |
" Write all buffers before navigating from Vim to tmux pane | |
let g:tmux_navigator_save_on_switch = 2 | |
let g:tmux_navigator_no_mappings = 1 | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
" NerdTree | |
map <C-n> :NERDTreeToggle<CR> | |
let g:NERDTreeDirArrowExpandable = '►' | |
let g:NERDTreeDirArrowCollapsible = '▼' | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd FileType c,cpp,java,php,ruby,python,elixir,css,javascript,elm autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() | |
let g:elm_format_autosave = 1 | |
let g:elm_syntastic_show_warnings = 1 | |
let g:ycm_semantic_triggers = { | |
\ 'elm' : ['.'], | |
\} | |
let g:html_indent_inctags = "html,body,head,tbody" | |
let g:jsx_ext_required = 0 " Allow JSX in normal JS files | |
let g:syntastic_javascript_flow_exe = 'flow' | |
let g:flow#autoclose = 1 | |
let g:flow#enable = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment