set nocompatible " Vim settings, rather then Vi settings filetype off " required set visualbell t_vb= call plug#begin('~/.vim_bundle') " ========================================================== " My Plugs here: " ========================================================== " """"""" General plugins Plug 'tpope/vim-fugitive' Plug 'idanarye/vim-merginal' Plug 'majutsushi/tagbar' Plug 'gorkunov/smartpairs.vim' Plug 'gorkunov/smartgf.vim' Plug 'honza/vim-snippets' Plug 'SirVer/ultisnips' let g:UltiSnipsEditSplit='vertical' let g:UltiSnipsExpandTrigger = '' let g:UltiSnipsJumpForwardTrigger = '' let g:UltiSnipsJumpBackwardTrigger = '' let g:UltiSnipsSnippetDirectories=['UltiSnips', $HOME.'/dotfiles/dots/.vim/UltiSnips'] Plug 'ervandew/supertab' let g:SuperTabDefaultCompletionType = '' Plug 'scrooloose/nerdtree' let g:NERDTreeAutoCenter = 1 let g:NERDTreeAutoCenterThreshold = 8 let g:NERDTreeChDirMode = 2 let g:NERDTreeHighlightCursorline = 1 let g:NERDTreeIgnore = ['.DS_Store', '.git$[[dir]]', 'target$[[dir]]'] let g:NERDTreeWinSize = 50 let g:NERDTreeShowHidden = 1 let g:NERDTreeShowLineNumbers = 0 let g:NERDTreeMinimalUI = 1 " Plug 'low-ghost/nerdtree-fugitive' " Plug 'Xuyuanp/nerdtree-git-plugin' " Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " let g:NERDTreeLimitedSyntax = 1 " let g:NERDTreeDisableExactMatchHighlight = 1 " let g:NERDTreeDisablePatternMatchHighlight = 1 " let g:NERDTreeFileExtensionHighlightFullName = 1 Plug 'tpope/vim-repeat' Plug 'Valloric/YouCompleteMe' let g:ycm_key_list_select_completion = ['', ''] let g:ycm_key_list_previous_completion = ['', ''] let g:ycm_min_num_of_chars_for_completion = 1 Plug 'troydm/easybuffer.vim' let g:easybuffer_sort_mode = 's' Plug 'vim-scripts/camelcasemotion' Plug 'chrisbra/NrrwRgn' " :NR on visual-selected region to open it in narrowed window Plug 'nelstrom/vim-visual-star-search' " Star(*) search for the whole selection in visual mode Plug 'tomtom/tcomment_vim' " gcc Plug 'tpope/vim-surround' " ds, cs}), yss

Plug 'briandoll/change-inside-surroundings.vim' " cit to change inside tag, ci[ to change inside [] Plug 'godlygeek/tabular' " :Tab [pattern] Plug 'tpope/vim-unimpaired' " [space, ]space etc Plug 'jiangmiao/auto-pairs' " Automatic closing of quotes, parenthesis, brackets, etc. Plug 'AndrewRadev/splitjoin.vim' " gS to split single-line statement, gJ for the opposite Plug 'vim-scripts/YankRing.vim' " Go through paste-stack with OPTION-[pP] let g:yankring_replace_n_pkey='Ο€' let g:yankring_replace_n_nkey='∏' Plug 'terryma/vim-multiple-cursors' " Yay ^_^ let g:multi_cursor_use_default_mapping=0 let g:multi_cursor_next_key='' let g:multi_cursor_prev_key='' let g:multi_cursor_skip_key='' let g:multi_cursor_quit_key='' Plug 'duff/vim-bufonly' """"""" Navigation Plug 'Lokaltog/vim-easymotion' let g:EasyMotion_smartcase = 1 Plug 'paradigm/TextObjectify' Plug 'mileszs/ack.vim' cabbrev Ack Ack! cabbrev Ag Ag! let g:ackprg = 'ag --vimgrep' let g:ackhighlight = 1 Plug 'skwp/greplace.vim' Plug 'dkprice/vim-easygrep' let g:EasyGrepCommand=1 let g:EasyGrepRecursive=1 let g:EasyGrepHidden=0 let g:EasyGrepFilesToExclude='*.swp' if executable('ag') " Note we extract the column as well as the file and line number set grepprg=ag\ --vimgrep set grepformat=%f:%l:%c%m endif """""" JavaScript Plug 'jelera/vim-javascript-syntax' Plug 'pangloss/vim-javascript' Plug 'chemzqm/vim-jsx-improve' let g:jsx_ext_required = 0 " Plug 'maxmellon/vim-jsx-pretty' " let g:vim_jsx_pretty_colorful_config = 1 " let g:vim_jsx_pretty_enable_jsx_highlight = 1 Plug 'othree/yajs.vim' Plug 'othree/javascript-libraries-syntax.vim' let g:used_javascript_libs = 'underscore,react,rambda' Plug 'othree/es.next.syntax.vim' Plug 'ternjs/tern_for_vim', { 'do': 'npm install' } let g:tern_request_timeout = 5 let g:tern_show_argument_hints='on_hold' let g:tern_show_signature_in_pum = 1 Plug 'crusoexia/vim-javascript-lib' " Plug 'mxw/vim-jsx' " let g:jsx_ext_required = 0 Plug '1995eaton/vim-better-javascript-completion' Plug 'moll/vim-node' " Plug 'ahayman/vim-nodejs-complete' Plug 'elzr/vim-json' Plug 'maksimr/vim-jsbeautify' Plug 'einars/js-beautify' Plug 'isRuslan/vim-es6' Plug 'kchmck/vim-coffee-script' """""" Plugin ''CSS Plug 'JulesWang/css.vim' " Plug 'aaronjensen/vim-sass-status' Plug 'cakebaker/scss-syntax.vim' Plug 'hail2u/vim-css3-syntax' Plug 'lukaszb/vim-web-indent' Plug 'groenewege/vim-less' """""" UI " Plug 'chrisbra/vim-autoread' Plug 'w0rp/ale' let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_warning_str = 'W' let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' " let g:ale_sign_error = '😱' " ' ' let g:ale_sign_warning = ' ' let g:ale_javascript_eslint_executable = 'eslint_d' let g:ale_linters = {'javascript': ['eslint', 'flow'], 'html': []} " if I become annoyed about ALE showing errors for half-typed text, perhaps " I'll want to uncomment these: ""let g:ale_lint_on_save = 1 ""let g:ale_lint_delay = 1000 ""let g:ale_lint_on_text_changed = 0 " Plug 'neomake/neomake' " " let g:neomake_verbose = 3 " " let g:neomake_open_list=2 " " let g:neomake_list_height=20 " let g:neomake_javascript_eslint_maker = { " \ 'errorformat': '%E%f: line %l\, col %c\, Error - %m,' . " \ '%W%f: line %l\, col %c\, Warning - %m', " \ 'exe': "eslint_d", " \ 'args': ['--parser=babel-eslint', '-f', 'compact', '--rule', '{"no-console":[1]}'], " \ } " " " Advanced flow errors " " https://github.com/ryyppy/flow-vim-quickfix " function! StrTrim(txt) " return substitute(a:txt, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '') " endfunction " " let g:neomake_javascript_enabled_makers = ['eslint'] " let g:neomake_jsx_enabled_makers = ['eslint'] " temp hack to get flow working with Neomake " " let g:flow_path = StrTrim(system('PATH=$(npm bin):$PATH && which flow')) " " if findfile('.flowconfig', '.;') !=# '' " let g:flow_path = StrTrim(system('PATH=$(npm bin):$PATH && which flow')) " if g:flow_path != 'flow not found' " let g:neomake_javascript_flow_maker = { " \ 'exe': 'sh', " \ 'args': ['-c', g:flow_path.' --json 2> /dev/null | flow-vim-quickfix'], " \ 'errorformat': '%E%f:%l:%c\,%n: %m', " \ 'cwd': '%:p:h' " \ } " let g:neomake_javascript_enabled_makers = g:neomake_javascript_enabled_makers + [ 'flow'] " let g:neomake_jsx_enabled_makers = g:neomake_jsx_enabled_makers + [ 'flow'] " endif " endif " " autocmd VimEnter,BufWritePost * Neomake Plug 'airblade/vim-gitgutter' Plug 'kien/rainbow_parentheses.vim' Plug 'wting/rust.vim' Plug 'chrisbra/color_highlight' Plug 'jonathanfilip/vim-lucius' Plug 'benjaminwhite/Benokai' Plug 'w0ng/vim-hybrid' let g:hybrid_custom_term_colors = 1 let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. Plug 'mhartington/oceanic-next' Plug 'altercation/vim-colors-solarized' Plug 'mkitt/tabline.vim' Plug 'bling/vim-airline' " UI statusbar niceties set laststatus=2 " enable airline even if no splits let g:airline#enable#branch=1 let g:airline_powerline_fonts = 1 " let g:airline_theme='light' " let g:airline_theme='hybrid' let g:airline_theme='oceanicnext' let g:airline#left#sep = '' let g:airline#right#sep = '' let g:airline#linecolumn#prefix = '␊ ' let g:airline#linecolumn#prefix = '␀ ' let g:airline#linecolumn#prefix = 'ΒΆ ' let g:airline#branch#prefix = 'βŽ‡ ' let g:airline#paste#symbol = 'ρ' let g:airline#paste#symbol = 'Þ' let g:airline#paste#symbol = 'βˆ₯' " ALE (linting) integration let g:airline#extensions#ale#error_symbol = 'E:' let g:airline#extensions#ale#warning_symbol = 'W:' " let g:airline_extensions_add = ['neomake'] let g:airline#extensions#nrrwrgn#enabled = 1 let g:airline#extensions#hunks#enabled = 0 " Tabline settings let g:airline#extensions#tabline#enabled = 1 " Formatter defined in " autoload/airline/extensions/tabline/formatters/jsformatter.vim let g:airline#extensions#tabline#formatter = 'jsformatter' let g:airline#extensions#tabline#show_buffers = 0 let g:airline#extensions#tabline#show_splits = 0 let g:airline#extensions#tabline#show_tabs = 1 let g:airline#extensions#tabline#tab_nr_type = 0 let g:airline#extensions#tabline#show_tab_nr = 0 let g:airline#extensions#tabline#show_tab_type = 0 let g:airline#extensions#tabline#tab_min_count = 1 let g:airline#extensions#tabline#show_close_button = 0 Plug 'jaxbot/semantic-highlight.vim' let g:semanticEnableFileTypes = ['javascript', 'javascript.jsx', 'coffee', 'py', 'rb'] " """"""" Templates Plug 'othree/html5.vim' Plug 'digitaltoad/vim-jade' Plug 'mattn/emmet-vim' " Let me expand emmet abbr with let g:user_emmet_expandabbr_key = ',' let g:user_emmet_settings = { \ 'javascript' : { \ 'extends' : 'jsx', \ }, \ 'javascript.jsx' : { \ 'extends' : 'jsx', \ }, \} Plug 'dag/vim2hs' Plug 'tpope/vim-endwise' " Plug 'tpope/vim-rails' " Plug 'tpope/vim-haml' " ========================================================= if has("gui_running") Plug 'ctrlpvim/ctrlp.vim' Plug 'FelikZ/ctrlp-py-matcher' let g:ctrlp_by_filename = 0 " Search by filename let g:ctrlp_match_window_bottom = 1 " show at bottom of window let g:ctrlp_working_path_mode = 'ra' " our working path is our vcs project or the current directory let g:ctrlp_mru_files = 1 " enable most recently used files feature let g:ctrlp_jump_to_buffer = 2 " jump to tab and buffer if already open let g:ctrlp_open_new_file = 'r' " open selections in a vertical split let g:ctrlp_open_multiple_files = 'vr' " opens multiple selections in vertical splits to the right let g:ctrlp_arg_map = 0 let g:ctrlp_split_window = 0 let g:ctrlp_max_height = 40 " restrict match list to a maxheight of 40 let g:ctrlp_use_caching = 0 " don't cache, we want new list immediately each time let g:ctrlp_max_files = 0 " no restriction on results/file list let g:ctrlp_working_path_mode = '' let g:ctrlp_dont_split = 'NERD_tree_2' " don't split these buffers let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/]\.(git|hg|svn|gitkeep)$', \ 'file': '\v\.(svg|exe|so|dll|log|gif|jpg|jpeg|png|psd|DS_Store|ctags|gitattributes)$' \ } let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' else Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' set rtp+=/usr/local/opt/fzf let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' nmap :FZF Plug 'ryanoasis/vim-devicons' " ----------------------------------------------------------------------------- " SETTINGS - devicons " ----------------------------------------------------------------------------- let g:WebDevIconsOS = 'Darwin' let g:WebDevIconsUnicodeDecorateFolderNodes = 1 let g:webdevicons_conceal_nerdtree_brackets = 1 let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' let g:WebDevIconsUnicodeGlyphDoubleWidth = 1 let g:WebDevIconsNerdTreeGitPlugForceVAlign = 0 " Fix half display issue let s:blank = '' let g:NERDTreeExactMatchHighlightColor = { \ 'dropbox' : s:blank, \ '.ds_store' : s:blank, \ '.gitconfig' : s:blank, \ '.gitignore' : s:blank, \ '.bashrc' : s:blank, \ '.bashprofile' : s:blank, \ 'favicon.ico' : s:blank, \ 'license' : s:blank, \ 'node_modules' : s:blank, \ 'procfile' : s:blank, \} endif call plug#end() " ========================================================== " UI Settings " ========================================================== set t_Co=256 set background=dark set termguicolors " colorscheme hybrid let $NVIM_TUI_ENABLE_TRUE_COLOR=1 colorscheme OceanicNext let g:oceanic_next_terminal_bold = 1 let g:oceanic_next_terminal_italic = 1 " colorscheme OceanicNext " override default theme search highlighter autocmd ColorScheme * hi Search guibg=NONE ctermbg=NONE gui=underline cterm=underline term=underline guifg=#80cbc4 ctermfg=darkcyan " colorscheme Benokai " colorscheme molokai " colorscheme solarized " let g:solarized_termcolors=256 " let g:solarized_termtrans=1 let g:rbpt_colorpairs = [ \ ['brown', 'RoyalBlue3'], \ ['Darkblue', 'SeaGreen3'], \ ['darkgray', 'DarkOrchid3'], \ ['darkgreen', 'firebrick3'], \ ['darkcyan', 'RoyalBlue3'], \ ['darkred', 'SeaGreen3'], \ ['darkmagenta', 'DarkOrchid3'], \ ['brown', 'firebrick3'], \ ['gray', 'RoyalBlue3'], \ ['darkmagenta', 'DarkOrchid3'], \ ['Darkblue', 'firebrick3'], \ ['darkgreen', 'RoyalBlue3'], \ ['darkcyan', 'SeaGreen3'], \ ['darkred', 'DarkOrchid3'], \ ['red', 'firebrick3'], \ ] " ========================================================== " Shortcuts " ========================================================== " Warning: nightmare mode! " Disable mouse set mouse= " Disable inoremap inoremap inoremap inoremap noremap noremap noremap noremap inoremap # # " Navigate with -hjkl in Insert mode imap h imap j imap k imap l " Navigate through wrapped lines noremap j gj noremap k gk " Clear the search highlight in Normal mode nnoremap :nohlsearch " Allow pasting blocks of code without indenting set pastetoggle= " Seriously, guys. It's not like :W is bound to anything anyway. command! W :w " Go through CamelCased words map W CamelCaseMotion_w map B CamelCaseMotion_b map E CamelCaseMotion_e sunmap W sunmap B sunmap E vmap :wq nmap ge :TComment nnoremap li " Fix Shift+Tab nmap << imap <:tabnew map ,b :Gblame map ,n :call WorkaroundNERDTreeToggle() noremap ,w :w noremap ,W :w!! noremap ,s :w map ,q :q map ,Q :q! map ,c :setlocal spell! " nmap ,l :EasyBufferHorizontalBelow nmap ,r :NERDTreeFind nmap ,m :MerginalToggle map ba :1,100bd! nnoremap f :Ack! "" nmap / :tabo:BufOnly nmap h :SemanticHighlightToggle " nmap . f il nmap . /\%=line('.')l\( \\|>\\|<\)il if has("gui_running") nmap p :CtrlPMRU nmap o :CtrlPBuffer else nmap p :Buffers nmap o :Ag nmap l :Lines endif " Let me delete non-empty folders through netrw let g:netrw_localrmdir='rm -r' " Ctags: open tag in vertical|horizontal split OPTION-[] map β€˜ :vsp :exec("tag ".expand("")) map β€œ :sp :exec("tag ".expand("")) " Jump 10 lines OPTION-[jk] map βˆ† 10j map ˚ 10k " Quickly move between windows CTRL-[hjkl] map h map l map j map k " Switch tabs with OPTION-[,.] map ≀ :tabp map β‰₯ :tabn " Switch buffers with OPTION-[hl] map Β¬ :bnext map Λ™ :bprev " Move lines with OPTION-[;'] nnoremap … :m .+1== nnoremap Γ¦ :m .-2== inoremap … :m .+1==gi inoremap Γ¦ :m .-2==gi vnoremap … :m '>+1gv=gv vnoremap Γ¦ :m '<-2gv=gv " Easymotion plugin mappings map ? (easymotion-sn) omap ? (easymotion-tn) " Easy jump to line map j (easymotion-j) map k (easymotion-k) " Search by two characters " After search you can type . to repeat action performed after previous search nmap t (easymotion-s2) nmap s (easymotion-s) " Maximize current split window CTRL-0 " To return to equal sizes CTRL-= map 0 :call FullScreenSplit() function FullScreenSplit() :NERDTreeClose :res :vertical res endfunction " Let me save files with SUDO cmap w!! w !sudo tee % >/dev/null :set path=$PWD/** " For fugitive.git, dp means :diffput. Define dg to mean :diffget nnoremap ,dg :diffget nnoremap ,dp :diffput " Automatically jump to a file at the correct line number nnoremap ,gf :vertical botright wincmd F " Open all changed git files nnoremap ,ocf :OpenChangedFiles " use ,F to jump to tag in a vertical split nnoremap ,F :let word=expand(""):vsp:wincmd w:exec("tag ". word) " ========================================================== " Basic Settings " ========================================================== syntax enable filetype on " try to detect filetypes filetype plugin indent on " enable loading indent file for filetype set number " Display line numbers set numberwidth=1 " using only 1 column (and 1 space) while possible set title " show title in console title bar set autoread " Reload files changed outside of vim set scrolloff=8 " Start scrolling when we're 8 lines away from margins set sidescrolloff=15 set sidescroll=1" set fileformats=unix set nrformats= set showcmd set cpoptions+=$ set virtualedit=all set clipboard=unnamed set clipboard+=unnamedplus set gfn=Monaco:h16 " set colorcolumn=120 " e ++ff=unix set tw=0 set wm=0 set wrap set linebreak """"""" Completion menu set wildmenu " Menu completion in command mode on set wildmode=list:longest,full " cycles between all matching choices. set wildignore=*.o,*.obj,*~ " Stuff to ignore when tab completing set wildignore+=*vim/backups* set wildignore+=*sass-cache* set wildignore+=*DS_Store* set wildignore+=vendor/rails/** set wildignore+=vendor/cache/** set wildignore+=*.gem set wildignore+=log/** set wildignore+=tmp/** set wildignore+=*.png,*.jpg,*.gif set completeopt-=preview " set completeopt=longest,menuone,preview set tabstop=2 set shiftwidth=2 set expandtab set smarttab set autoindent set smartindent set mouse=a set regexpengine=1 " Use old regex engine for better performance set cursorline set timeoutlen=200 set ls=2 "Always show status line" set ruler set hidden set nolazyredraw set showmatch set encoding=utf8 set backspace=indent,eol,start set nobackup set noswapfile " displays tabs with :set list & displays when a line runs off-screen set listchars=tab:>.,trail:~,precedes:<,extends:> set list au FileType go set nolist """ Searching and Patterns set ignorecase " Default to using case insensitive searches, set smartcase " unless uppercase letters are used in the regex. set smarttab " Handle tabs more intelligently set hlsearch " Highlight searches by default. set incsearch " Incrementally search while typing a /regex au FocusLost * silent! wa " =========================================================== " FileType specific changes " ============================================================ autocmd FileType javascript noremap :call JsBeautify() " autocmd FileType javascript :SemanticHighlight() autocmd FileType javascript setlocal omnifunc=tern#Complete autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType css noremap :call CSSBeautify() autocmd FileType html noremap :call HtmlBeautify() autocmd BufRead,BufNewFile *.hamlc setf haml autocmd BufRead,BufNewFile *.scss setf scss.css autocmd BufRead,BufNewFile, *rc setf javascript " au BufRead *.js set makeprg=eslint\ % " Use tab to scroll through autocomplete menus "autocmd VimEnter * imap pumvisible() ? "" : "" "autocmd VimEnter * imap pumvisible() ? "" : "" " autocmd FileType html,xhtml,xml,css setlocal expandtab shiftwidth=2 tabstop=2 " autocmd filetype javascript set sw=2 ts=2 expandtab " au FileType coffeescript setl sw=2 sts=2 et " Exec js script in vim CTRL-w-n map n :call ExecNode() function ExecNode() exec "! node %" endfunction " Toggle NERDTree after all buffers delete function! WorkaroundNERDTreeToggle() try | NERDTreeToggle | catch | silent! NERDTree | endtry endfunction """"" Normalization ==================== map T :call DeleteTrailingWS() " Delete trailing white space on save func! DeleteTrailingWS() exe "normal mz" %s/\s\+$//ge exe "normal `z" endfunc au BufWrite * silent call DeleteTrailingWS() """"" End Normalization ================ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " OpenChangedFiles COMMAND " Open a split for each dirty file in git " " Shamelessly stolen from Gary Bernhardt: https://github.com/garybernhardt/dotfiles """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" function! OpenChangedFiles() only " Close all windows, unless they're modified let status = system('git status -s | grep "^ \?\(M\|A\)" | cut -d " " -f 3') let filenames = split(status, "\n") if len(filenames) > 0 exec "edit " . filenames[0] for filename in filenames[1:] exec "sp " . filename endfor end endfunction command! OpenChangedFiles :call OpenChangedFiles() " ----------------------------------------------------------------------------- " INIT " ----------------------------------------------------------------------------- if exists("g:loaded_webdevicons") call webdevicons#refresh() endif " Sad truth :( function! SetSadTabWidth() set tabstop=4 set shiftwidth=4 set softtabstop=4 endfunction command! SadTabWidth :call SetSadTabWidth() " Automatically create any non-existent directories before writing the buffer function! s:Mkdir() let dir = expand('%:p:h') if !isdirectory(dir) call mkdir(dir, 'p') echo 'Created non-existing directory: '.dir endif endfunction autocmd BufWritePre * call s:Mkdir()