" plugins " call plug#begin('~/.vim/plugged') Plug 'itchyny/lightline.vim' Plug 'sonph/onehalf', { 'rtp': 'vim' } Plug 'tpope/vim-fugitive' Plug 'NLKNguyen/papercolor-theme' Plug 'fatih/vim-go' Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} call plug#end() " colors " set t_Co=256 "required for urxvt set background=dark "dark or light " colorscheme PaperColor let g:lightline = { \ 'colorscheme': 'onehalfdark', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { \ 'gitbranch': 'FugitiveHead' \ }, \ } " Hide insert(redundant because of lightline plugin) set noshowmode " Clear the background in order to have opacity hi Normal guibg=NONE ctermbg=NONE hi clear SignColumn hi clear LineNr " settings " filetype on "detect files based on type filetype plugin on "when a file is edited its plugin file is loaded filetype indent on "maintain indentention set nu "enable line numbers set relativenumber "relative line numbers set colorcolumn=100 "display a colored column at 100 chars highlight ColorColumn ctermbg=0 guibg=morning " ------------------------------------------------------------------------------------------------- " coc.nvim default settings " " ------------------------------------------------------------------------------------------------- " if hidden is not set, TextEdit might fail. set hidden " Better display for messages set cmdheight=2 " Smaller updatetime for CursorHold & CursorHoldI set updatetime=300 " don't give |ins-completion-menu| messages. set shortmess+=c " always show signcolumns set signcolumn=yes " Use tab for trigger completion with characters ahead and navigate. " Use command ':verbose imap ' to make sure tab is not mapped by other plugin. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() " Use `[c` and `]c` to navigate diagnostics nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use U to show documentation in preview window nnoremap U :call show_documentation() " Remap for rename current word nmap rn (coc-rename) " Remap for format selected region vmap f (coc-format-selected) nmap f (coc-format-selected) " Show all diagnostics nnoremap a :CocList diagnostics " Manage extensions nnoremap e :CocList extensions " Show commands nnoremap c :CocList commands " Find symbol of current document nnoremap o :CocList outline " Search workspace symbols nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. nnoremap k :CocPrev " Resume latest coc list nnoremap p :CocListResume " disable vim-go :GoDef short cut (gd) " this is handled by LanguageClient [LC] let g:go_def_mapping_enabled = 0 " Explorer nmap e :CocCommand explorer nmap f :CocCommand explorer --preset floating autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif " Prettier command! -nargs=0 Prettier :CocCommand prettier.formatFile