" Plugins call plug#begin('~/.vim/plugged') " Startify Plug 'mhinz/vim-startify' " Theme Plug 'kyoz/purify', { 'rtp': 'vim' } " Surround Plug 'tpope/vim-surround' " Lightline Plug 'itchyny/lightline.vim' Plug 'mengelbrecht/lightline-bufferline' " Distraction-free Plug 'junegunn/goyo.vim' " Syntax Plug 'sheerun/vim-polyglot' Plug 'kevinoid/vim-jsonc' " Color highlight Plug 'ap/vim-css-color' " Symlink Plug 'aymericbeaumet/vim-symlink' " Code completion Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'phpactor/phpactor', { 'for': 'php', 'branch': 'master', 'do': 'composer install --no-dev -o' } " ALE Plug 'dense-analysis/ale' " Emmet Plug 'mattn/emmet-vim' " Debugging Plug 'puremourning/vimspector' " Git Plug 'tpope/vim-fugitive', { 'tag': 'v3.2' } Plug 'airblade/vim-gitgutter' " Obsession Plug 'tpope/vim-obsession' " NERDTree Plug 'preservim/nerdtree' Plug 'Xuyuanp/nerdtree-git-plugin' " VimDevIcons Plug 'ryanoasis/vim-devicons' " Snippets Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' " FZF Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' " Bufonly Plug 'schickling/vim-bufonly' call plug#end() syntax on colorscheme purify set nocompatible " .exrc set exrc set secure " Mouse set mouse=a if !has('nvim') set ttymouse=sgr endif " .vimrc nnoremap :e ~/.vimrc nnoremap :so ~/.vimrc " Indentation filetype plugin indent on set expandtab set tabstop=4 set shiftwidth=4 set autoindent set smartindent " Search set hlsearch " FZF nnoremap fa :Ag nnoremap fb :Buffers nnoremap fc :Commands nnoremap fg :GitFiles nnoremap fhc :History: nnoremap fhs :History/ nnoremap ff :Files nnoremap fr :Rg nnoremap fm :Maps " Lightline set laststatus=2 set cmdheight=2 set showtabline=2 let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'cocstatus', 'readonly', 'filename', 'modified', 'gitbranch'] ] \ }, \ 'tabline': { \ 'left': [ ['buffers'] ] \ }, \ 'component_expand': { \ 'buffers': 'lightline#bufferline#buffers' \ }, \ 'component_function': { \ 'cocstatus': 'coc#status', \ 'gitbranch': 'FugitiveHead' \ }, \ 'component_type': { \ 'buffers': 'tabsel' \ } \ } let g:lightline#bufferline#show_number = 1 let g:lightline#bufferline#enable_devicons = 1 let g:lightline#bufferline#clickable = 1024 let g:lightline.component_raw = {'buffers': 1} " Buffers nnoremap b :ls:b nnoremap cb :BufOnly " Distraction-free nnoremap g :Goyo " Line numbers set number set relativenumber " Undo set undofile set undodir=~/.vim/undo set undolevels=1024 " Backup set nobackup set nowritebackup " updatetime set updatetime=450 " ALE let g:ale_disable_lsp = 1 " Debugging let g:vimspector_enable_mappings = 'HUMAN' nmap di VimspectorBalloonEval xmap di VimspectorBalloonEval nmap dr :VimspectorReset " Tabs nnoremap :tabprevious nnoremap :tabnext nnoremap :tabprevious nnoremap :tabnext " Clipboard vmap "+y " NERDTree autocmd StdinReadPre * let s:std_in=1 "autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif let g:NERTreeChDirMode = 2 map :NERDTreeToggle nnoremap :NERDTreeFind " Code completion set hidden set shortmess+=c set signcolumn=yes 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 if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif inoremap pumvisible() ? coc#_select_confirm() \: "\u\\=coc#on_enter()\" nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction autocmd CursorHold * silent call CocActionAsync('highlight') nmap rn (coc-rename) xmap f (coc-format-selected) nmap f (coc-format-selected) xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) nmap ac (coc-codeaction) nmap qf (coc-fix-current) xmap if (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap af (coc-funcobj-a) xmap ic (coc-classobj-i) omap ic (coc-classobj-i) xmap ac (coc-classobj-a) omap ac (coc-classobj-a) if has('nvim-0.4.0') || has('patch-8.2.0750') nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" endif if has('nvim') vnoremap coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\" vnoremap coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\" endif nmap (coc-range-select) xmap (coc-range-select) command! -nargs=0 Format :call CocAction('format') command! -nargs=? Fold :call CocAction('fold', ) command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') nnoremap a :CocList diagnostics nnoremap e :CocList extensions nnoremap c :CocList commands nnoremap o :CocList outline nnoremap s :CocList -I symbols nnoremap j :CocNext nnoremap k :CocPrev nnoremap p :CocListResume set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Use for trigger snippet expand. imap (coc-snippets-expand) " Use for select text for visual placeholder of snippet. vmap (coc-snippets-select) " Use for jump to next placeholder, it's default of coc.nvim let g:coc_snippet_next = '' " Use for jump to previous placeholder, it's default of coc.nvim let g:coc_snippet_prev = '' " Use for both expand and jump (make expand higher priority.) imap (coc-snippets-expand-jump) " Use x for convert visual selected code to snippet xmap x (coc-convert-snippet) inoremap \ pumvisible() ? coc#_select_confirm() : \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ check_back_space() ? "\" : \ coc#refresh() function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction let g:coc_snippet_next = ''