Advertisement
QinghaoHu

Final COC vimrc

Mar 14th, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. "cliboard-setting
  2. set clipboard=unnamed
  3. set ruler
  4. "font
  5. "set gfn=SauceCodePro\ NFM:h10
  6. "set gfn=consolas:h15
  7. "set gfn=FiraCode\ Nerd\ Font\ Mono:h10
  8. "set gfn=JetBrainsMono\ Nerd\ Font\ Mono:h10
  9. set gfn=FixedsysExcelsiorIIIb_NFM:h12
  10. set gfn=Consolas\ NF:h10.5
  11. "filesetting
  12. set hidden
  13. set backspace=2
  14. set noswapfile
  15. set nobackup
  16. set nocompatible
  17. set encoding=utf-8
  18.  
  19. set nu
  20. set splitbelow
  21. "set relativenumber
  22. "syntax
  23. syntax on
  24.  
  25. "indent
  26. set autoindent
  27. set smartindent
  28. set cindent
  29. "set cursorline
  30. set expandtab
  31. set smarttab
  32.  
  33. "tab
  34. set ts=4
  35. set sw=4
  36.  
  37. "set auto-pairs
  38. inoremap {<CR> {<CR>}<ESC>O
  39. inoremap { {}<ESC>i
  40. inoremap } <c-r>=ClosePair('}')<CR>
  41. inoremap ( ()<ESC>i
  42. inoremap ) <c-r>=ClosePair(')')<CR>
  43. inoremap [ []<ESC>i
  44. inoremap ] <c-r>=ClosePair(']')<CR>
  45. function! ClosePair(char)
  46. if getline('.')[col('.') - 1] == a:char
  47. return "\<Right>"
  48. else
  49. return a:char
  50. endif
  51. endfunction
  52.  
  53. "Compile
  54. func! Comp()
  55. exec "w"
  56. if &filetype == "cpp"
  57. exec "!g++ -O2 -std=c++17 -Wall -Wfatal-errors % -o %<"
  58. elseif &filetype == "cc"
  59. exec "!g++ -O2 -std=c++17 -Wall -Wfatal-errors % -o %<"
  60. elseif &filetype == "java"
  61. exec "!javac %"
  62. endif
  63. endfunc
  64. set guioptions -=T
  65. func! Run()
  66. exec "w"
  67. if &filetype == "java"
  68. exec "!java %<"
  69. elseif &filetype == "cc"
  70. exec "!%<.exe"
  71. elseif &filetype == "cpp"
  72. exec "!%<.exe"
  73. endif
  74. endfunc
  75.  
  76. call plug#begin('~/vimfiles/plugged')
  77. Plug 'vim-airline/vim-airline'
  78. Plug 'vim-airline/vim-airline-themes'
  79. Plug 'christoomey/vim-tmux-navigator'
  80. Plug 'fenetikm/falcon'
  81. Plug 'octol/vim-cpp-enhanced-highlight'
  82. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  83. Plug 'sonph/onehalf', { 'rtp': 'vim' }
  84. Plug 'altercation/vim-colors-solarized'
  85. Plug 'morhetz/gruvbox'
  86. Plug 'Yggdroot/indentLine'
  87. Plug 'tinted-theming/base16-vim'
  88. Plug 'sainnhe/gruvbox-material'
  89. Plug 'echasnovski/mini.base16'
  90. Plug 'vim-airline/vim-airline-themes'
  91. Plug 'junegunn/seoul256.vim'
  92. Plug 'lifepillar/vim-solarized8'
  93. Plug 'sainnhe/sonokai'
  94. Plug 'ryanoasis/vim-devicons'
  95. Plug 'joshdick/onedark.vim'
  96. Plug 'tomasiser/vim-code-dark'
  97. Plug 'preservim/nerdtree'
  98. Plug 'preservim/tagbar'
  99. Plug 'lycuid/vim-far'
  100. call plug#end()
  101.  
  102. set background=dark
  103.  
  104. "colorscheme base16-google-dark
  105. "colorscheme base16-gruvbox-material-dark-hard
  106. "colorscheme base16-gruvbox-material-light-hard
  107. "colorscheme base16-solarized-dark
  108. "colorscheme base16-solarized-light
  109. "colorscheme base16-tokyo-night-light
  110. "colorscheme base16-tokyo-night-terminal-light
  111. "colorscheme base16-kanagawa
  112. "colorscheme base16-spaceduck
  113. "colorscheme base16-eighties
  114. "colorscheme base16-tube
  115. "colorscheme base16-spacemacs
  116. "colorscheme base16-selenized-light
  117. "colorscheme base16-selenized-black
  118. "colorscheme base16-windows-highcontrast
  119. "colorscheme base16-windows-nt-light
  120. "colorscheme base16-windows-95-light
  121. "let g:seoul256_background = 256
  122. "colorscheme seoul256
  123. "colorscheme solarized8_high
  124. "colorscheme sonokai
  125. "colorscheme onedark
  126. "colorscheme codedark
  127. "colorscheme onehalflight
  128. colorscheme far
  129. noremap x :bd<CR>
  130.  
  131. augroup VIMRC
  132. au!
  133. au BufWritePost .vimrc so %
  134. augroup END
  135.  
  136. "set keymaps
  137. noremap <F2> :NERDTreeToggle<CR>
  138. noremap L :bn<CR>
  139. noremap H :bp<CR>
  140. noremap <F3> :!git status<CR>
  141. noremap <F4> :w<CR>
  142. noremap <F5> :CocRestart<CR>
  143. noremap <F6> :!git add .<CR>
  144. noremap <F7> :!git commit -m "
  145. noremap <F8> :TagbarToggle<CR>
  146. noremap J :u<CR>
  147. noremap <F9> :call Comp()<CR>
  148. noremap <F10> :!git push<CR>
  149. noremap <F11> :call Run()<CR>
  150. noremap <F12> :!%<.exe <
  151.  
  152. "background
  153. hi NONTEXT ctermbg=NONE
  154. hi NORMAL ctermbg=NONE
  155. "template
  156.  
  157. set laststatus=2 "永远显示状态栏
  158. let g:airline_powerline_fonts = 1 " 支持 powerline 字体
  159. let g:airline#extensions#tabline#enabled = 1
  160.  
  161. "syntax setting
  162. let g:cpp_class_scope_highlight = 1
  163. let g:cpp_member_variable_highlight = 1
  164. let g:cpp_class_decl_highlight = 1
  165. let g:cpp_posix_standard = 1
  166. let g:cpp_experimental_simple_template_highlight = 1
  167. let g:cpp_concepts_highlight = 1
  168.  
  169. set updatetime=300
  170.  
  171. inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
  172. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  173. inoremap <silent><expr> <TAB>
  174. \ coc#pum#visible() ? coc#_select_confirm() :
  175. \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
  176. \ CheckBackspace() ? "\<TAB>" :
  177. \ coc#refresh()
  178.  
  179. function! CheckBackspace() abort
  180. let col = col('.') - 1
  181. return !col || getline('.')[col - 1] =~# '\s'
  182. endfunction
  183.  
  184. let g:coc_snippet_next = '<tab>'
  185.  
  186. "indentline
  187. let g:indentLine_setColors = 0
  188.  
  189. "airline
  190. let g:airline#extensions#tabline#fnamemod = ':t'
  191.  
  192. let g:airline#extensions#tabline#show_tab_type = 0
  193.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement