hnOsmium0001

2019-11-26 .vimrc

Nov 28th, 2019
892
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " ================================================================
  2. " # Plugins
  3. " ================================================================
  4.  
  5. call plug#begin('~/.vim/plugged')
  6.  
  7. " NeoVim Compat
  8. Plug 'roxma/nvim-yarp'
  9. Plug 'roxma/vim-hug-neovim-rpc'
  10.  
  11. " Editing Enhancement
  12. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  13. Plug 'junegunn/vim-easy-align'
  14.  
  15. " GUI Enhancement
  16. Plug 'itchyny/lightline.vim'
  17. Plug 'junegunn/seoul256.vim'
  18.  
  19. Plug 'scrooloose/nerdtree'
  20. Plug 'scrooloose/nerdcommenter'
  21. Plug 'Xuyuanp/nerdtree-git-plugin'
  22. "Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippet/'
  23.  
  24. call plug#end()
  25.  
  26.  
  27.  
  28.  
  29. " ================================================================
  30. " # coc.nvim Settings
  31. " ================================================================
  32.  
  33. " if hidden is not set, TextEdit might fail.
  34. set hidden
  35.  
  36. " Some servers have issues with backup files, see #649
  37. set nobackup
  38. set nowritebackup
  39.  
  40. " Better display for messages
  41. set cmdheight=2
  42.  
  43. " You will have bad experience for diagnostic messages when it's default 4000.
  44. set updatetime=300
  45.  
  46. " don't give |ins-completion-menu| messages.
  47. set shortmess+=c
  48.  
  49. " always show signcolumns
  50. set signcolumn=yes
  51.  
  52. " Use tab for trigger completion with characters ahead and navigate.
  53. " Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
  54. inoremap <silent><expr> <TAB>
  55.       \ pumvisible() ? "\<C-n>" :
  56.       \ <SID>check_back_space() ? "\<TAB>" :
  57.       \ coc#refresh()
  58. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  59.  
  60. function! s:check_back_space() abort
  61.   let col = col('.') - 1
  62.   return !col || getline('.')[col - 1]  =~# '\s'
  63. endfunction
  64.  
  65. " Use <c-space> to trigger completion.
  66. inoremap <silent><expr> <c-space> coc#refresh()
  67.  
  68. " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
  69. " Coc only does snippet and additional edit on confirm.
  70. inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  71. " Or use `complete_info` if your vim support it, like:
  72. " inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
  73.  
  74. " Use `[g` and `]g` to navigate diagnostics
  75. nmap <silent> [g <Plug>(coc-diagnostic-prev)
  76. nmap <silent> ]g <Plug>(coc-diagnostic-next)
  77.  
  78. " Remap keys for gotos
  79. nmap <silent> gd <Plug>(coc-definition)
  80. nmap <silent> gy <Plug>(coc-type-definition)
  81. nmap <silent> gi <Plug>(coc-implementation)
  82. nmap <silent> gr <Plug>(coc-references)
  83.  
  84. " Use K to show documentation in preview window
  85. nnoremap <silent> K :call <SID>show_documentation()<CR>
  86.  
  87. function! s:show_documentation()
  88.   if (index(['vim','help'], &filetype) >= 0)
  89.     execute 'h '.expand('<cword>')
  90.   else
  91.     call CocAction('doHover')
  92.   endif
  93. endfunction
  94.  
  95. " Highlight symbol under cursor on CursorHold
  96. autocmd CursorHold * silent call CocActionAsync('highlight')
  97.  
  98. " Remap for rename current word
  99. nmap <leader>rn <Plug>(coc-rename)
  100.  
  101. " Remap for format selected region
  102. xmap <leader>f  <Plug>(coc-format-selected)
  103. nmap <leader>f  <Plug>(coc-format-selected)
  104.  
  105. augroup mygroup
  106.   autocmd!
  107.   " Setup formatexpr specified filetype(s).
  108.   autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  109.   " Update signature help on jump placeholder
  110.   autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
  111. augroup end
  112.  
  113. " Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
  114. xmap <leader>a  <Plug>(coc-codeaction-selected)
  115. nmap <leader>a  <Plug>(coc-codeaction-selected)
  116.  
  117. " Remap for do codeAction of current line
  118. nmap <leader>ac  <Plug>(coc-codeaction)
  119. " Fix autofix problem of current line
  120. nmap <leader>qf  <Plug>(coc-fix-current)
  121.  
  122. " Create mappings for function text object, requires document symbols feature of languageserver.
  123. xmap if <Plug>(coc-funcobj-i)
  124. xmap af <Plug>(coc-funcobj-a)
  125. omap if <Plug>(coc-funcobj-i)
  126. omap af <Plug>(coc-funcobj-a)
  127.  
  128. " Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
  129. nmap <silent> <C-d> <Plug>(coc-range-select)
  130. xmap <silent> <C-d> <Plug>(coc-range-select)
  131.  
  132. " Use `:Format` to format current buffer
  133. command! -nargs=0 Format :call CocAction('format')
  134.  
  135. " Use `:Fold` to fold current buffer
  136. command! -nargs=? Fold :call     CocAction('fold', <f-args>)
  137.  
  138. " use `:OR` for organize import of current buffer
  139. command! -nargs=0 OR   :call     CocAction('runCommand', 'editor.action.organizeImport')
  140.  
  141. " Add status line support, for integration with other plugin, checkout `:h coc-status`
  142. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
  143.  
  144. " Using CocList
  145. " Show all diagnostics
  146. nnoremap <silent> <space>a  :<C-u>CocList diagnostics<cr>
  147. " Manage extensions
  148. nnoremap <silent> <space>e  :<C-u>CocList extensions<cr>
  149. " Show commands
  150. nnoremap <silent> <space>c  :<C-u>CocList commands<cr>
  151. " Find symbol of current document
  152. nnoremap <silent> <space>o  :<C-u>CocList outline<cr>
  153. " Search workspace symbols
  154. nnoremap <silent> <space>s  :<C-u>CocList -I symbols<cr>
  155. " Do default action for next item.
  156. nnoremap <silent> <space>j  :<C-u>CocNext<CR>
  157. " Do default action for previous item.
  158. nnoremap <silent> <space>k  :<C-u>CocPrev<CR>
  159. " Resume latest coc list
  160. nnoremap <silent> <space>p  :<C-u>CocListResume<CR>
  161.  
  162. " Comments for json file
  163. autocmd FileType json syntax match Comment +\/\/.\+$+
  164.  
  165.  
  166.  
  167.  
  168. " ================================================================
  169. " # Other Plugin Settigs
  170. " ================================================================
  171.  
  172. " # Settings for lightline.vim
  173. set laststatus=2
  174.  
  175.  
  176. " # Settings for seoul256.vim
  177. let g:seoul256_background=234
  178. colo seoul256
  179.  
  180.  
  181.  
  182.  
  183. " ================================================================
  184. " # Regular Vim settings
  185. " ================================================================
  186.  
  187. " Visual stuff
  188. set number
  189. set nowrap
  190.  
  191. " Permanent undo
  192. set undodir=~/.vim/undo
  193. set undofile
  194.  
  195. " Tab configuration
  196. set shiftwidth=4
  197. set softtabstop=4
  198. set tabstop=4
  199. set noexpandtab
  200.  
  201. " Ctrl+J to switch to normal mode
  202. inoremap <C-j> <Esc>
  203. vnoremap <C-j> <Esc>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×