" Plugins {{{1 call plug#begin() " Language Plug 'sheerun/vim-polyglot' Plug 'reasonml-editor/vim-reason-plus' Plug 'mattn/emmet-vim' Plug 'tpope/vim-surround' Plug 'w0rp/ale' Plug 'fatih/vim-go', { 'tag': 'v1.21', 'do': ':GoUpdateBinaries', 'frozen': 1 } " Integration Plug 'tpope/vim-dispatch' Plug 'tpope/vim-projectionist' Plug 'tpope/vim-fugitive' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " Completion Plug 'SirVer/ultisnips' Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} " Interface Plug 'airblade/vim-gitgutter' Plug 'unblevable/quick-scope' " Commands Plug 'justinmk/vim-sneak' Plug 'tpope/vim-vinegar' Plug 'tpope/vim-commentary' Plug 'godlygeek/tabular' Plug 'wellle/targets.vim' Plug 'arithran/vim-delete-hidden-buffers' " Code Display Plug 'mhinz/vim-startify' " Plug 'morhetz/gruvbox' Plug 'robertmeta/nofrils' Plug 'chriskempson/base16-vim' Plug 'ap/vim-css-color' call plug#end() " Global Configuration Options {{{1 lang en_US.UTF-8 " Backup {{{2 set nowritebackup set noswapfile " Visual Indicator {{{2 set colorcolumn=81 " Set the 80 character column (+1 if textwidth is defined else 81) set cursorline " Highlight the current line set number set hidden " Any buffer can be hidden set linespace=0 " No extra spaces between rows " Writing {{{2 set lazyredraw " Render window only after the end of a macro set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set showmatch " Show current brackets " Scrolling {{{2 set scrolljump=5 " Lines to scroll when cursor leaves screen set scrolloff=3 " Minimum lines to keep above and below cursor " Window {{{2 set splitbelow " Puts new split windows to the bottom of the current set splitright " Puts new vsplit windows to the right of the current set winminheight=0 " Windows can be 0 line height set updatetime=100 " Faster refresh time " Fuzzy matching {{{2 set path+=** " fuzzy matching with :find *.ext* set wildignore+=**/node_modules/** " Ignore some folders set wildignore+=**/.git/** set wildignore+=**/build/** set wildignore+=**/dist/** " Folding {{{2 set foldmethod=syntax " Fold are defined by syntax highlighting " Indentation {{{2 " Don't enable smarindent or cindent with filetype plugin indent on filetype plugin indent on " Indentation based on filetype " Invisible characters {{{2 set list " Mouse {{{2 set mouse=a " Search {{{2 set ignorecase " Case insensitive search set smartcase " Case sensitive only if search contains uppercase letter. " Tabulation and spaces {{{2 set expandtab " Show spaces instead of tabs set shiftwidth=0 " columns per << set softtabstop=2 " spaces per tab set tabstop=2 " columns per tabs " Wrapping {{{2 set nowrap " Colors {{{2 set termguicolors " StatusLine {{{2 set statusline=%t " tail of the filename set statusline+=\ %h " help file flag set statusline+=%m " modified flag set statusline+=%r " read only flag set statusline+=%y " filetype set statusline+=%= " left/right separator set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, " file encoding set statusline+=%{&ff}]\ " file format set statusline+=%c\ " cursor column set statusline+=%l/%L\ " cursor line/total lines " Mappings {{{1 " Leader {{{2 let mapleader = "," let g:mapleader = "," " Fast saving {{{2 nmap w :w! " Visual mode pressing * or # searches for the current selection " Super useful! From an idea by Michael Naumann vnoremap * :call VisualSelection('', '')/=@/ vnoremap # :call VisualSelection('', '')?=@/ " Search {{{2 map / map ? " Disable highlight when is pressed map :noh " Windows {{{2 noremap h s noremap v v map j map k map h map l " Buffers {{{2 noremap bq :q map bd :Bclose map ba :bufdo bd map bo :only " Tabs {{{2 map tn :tabnew map to :tabonly noremap gt noremap gT map tc :tabclose map tm :tabmove map t :tabnext let g:lasttab = 1 nmap tl :exe "tabn ".g:lasttab au TabLeave * let g:lasttab = tabpagenr() map te :tabedit =expand("%:p:h")/ " Switch CWD to the directory of the open buffer map cd :cd %:p:h:pwd " Remap VIM 0 to first non-blank character noremap 0 ^ noremap ^ 0 " Pressing ,ss will toggle and untoggle spell checking map ss :setlocal spell! " Shortcuts using map sn ]s map sp [s map sa zg map s? z= " Remove the Windows ^M - when the encodings gets messed up noremap m mmHmt:%s///ge'tzt'm " Toggle paste mode on and off map pp :setlocal paste! " Git {{{2 nmap gs :Gstatus nmap ga :Git add -A nmap gb :Gblame nmap gc :Gcommit nmap gd :Gdiff nmap gl :Glog nmap gp :Gpush nmap gpl :Gpull nmap gr :Gread nmap gw :Gwrite nmap ge :Gedit " Function keys {{{2 noremap :ALEFix noremap :source $MYVIMRC nnoremap :e $MYVIMRC " UltiSnips {{{2 let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" " Git Gutter let g:gitgutter_map_keys = 0 " COC {{{2 nmap rg (coc-definition) nmap rr (coc-references) nmap ri (coc-implementation) nmap rd (coc-diagnostic-info) nmap rn (coc-diagnostic-next) nmap rp (coc-diagnostic-prev) " FZF {{{2 nmap fb :Buffers nmap ff :Files nnoremap fg :Ag nnoremap :syntax sync fromstart " Plugin Configuration {{{1 " FZF {{{2 let $FZF_DEFAULT_COMMAND = 'ag -g ""' " Emmet {{{2 let g:user_emmet_settings = { \ 'javascript.jsx' : { \ 'extends' : 'jsx', \ }, \ } " Ale {{{2 let g:ale_completion_enabled = 0 let g:ale_fix_on_save = 1 let g:ale_open_list = 'on_save' augroup CloseLoclistWindowGroup autocmd! autocmd QuitPre * if empty(&buftype) | lclose | endif augroup END let g:ale_linters = { \ 'javascript': ['flow', 'eslint'], \ 'pug': ['puglint'] \} let g:ale_fixers = { \ 'javascript': ['eslint'], \ 'perl': ['perl'], \ 'php': ['php_cs_fixer'], \ 'json': ['jq'], \ 'scss': ['prettier'], \ 'css': ['prettier'], \ 'html': ['prettier'], \ 'dart': ['dartfmt'], \ 'typescript': ['prettier'], \} let g:ale_sign_error = '✘' let g:ale_sign_warning = '⚠' " Startify {{{2 let g:startify_change_to_vcs_root = 1 let g:startify_change_to_dir = 0 let g:startify_lists = [ \ { 'type': 'dir', 'header': [' MRU '. getcwd()] }, \ { 'type': 'files', 'header': [' MRU'] }, \ { 'type': 'sessions', 'header': [' Sessions'] }, \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, \ { 'type': 'commands', 'header': [' Commands'] }, \ ] let g:ascii = [ \ ' ____ _ _ ', \ '/ ___|| | ___ _ __| | _____ __', \ '\___ \| |/ / | | |/ _` |/ _ \ \ / /', \ ' ___) | <| |_| | (_| | __/\ V / ', \ '|____/|_|\_\\__, |\__,_|\___| \_/ ', \ ' |___/ ', \ '' \] let g:startify_custom_header = \ map(g:ascii + startify#fortune#boxed(), '" ".v:val') " Colors {{{1 " Custom highlight {{{2 hi jsClassDefinition gui=bold hi jsFuncArgs gui=italic " Syntax options {{{2 let g:javascript_plugin_flow = 1 " Quick Scope {{{2 augroup qs_colors autocmd! autocmd ColorScheme * highlight QuickScopePrimary guifg='#00c200' gui=underline ctermfg=155 cterm=underline autocmd ColorScheme * highlight QuickScopeSecondary guifg='#00c5c7' gui=underline ctermfg=81 cterm=underline augroup END " Colorscheme {{{2 colorscheme base16-eighties " {{{0 " vim:fdm=marker:fdl=1