Advertisement
QinghaoHu

onedark vimrc

Dec 30th, 2023
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. j" Vim with all enhancements
  2. source $VIMRUNTIME/vimrc_example.vim
  3.  
  4. " Remap a few keys for Windows behavior
  5. source $VIMRUNTIME/mswin.vim
  6.  
  7. " Use the internal diff if available.
  8. " Otherwise use the special 'diffexpr' for Windows.
  9. if &diffopt !~# 'internal'
  10. set diffexpr=MyDiff()
  11. endif
  12. function MyDiff()
  13. let opt = '-a --binary '
  14. if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  15. if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  16. let arg1 = v:fname_in
  17. if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  18. let arg1 = substitute(arg1, '!', '\!', 'g')
  19. let arg2 = v:fname_new
  20. if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  21. let arg2 = substitute(arg2, '!', '\!', 'g')
  22. let arg3 = v:fname_out
  23. if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  24. let arg3 = substitute(arg3, '!', '\!', 'g')
  25. if $VIMRUNTIME =~ ' '
  26. if &sh =~ '\<cmd'
  27. if empty(&shellxquote)
  28. let l:shxq_sav = ''
  29. set shellxquote&
  30. endif
  31. let cmd = '"' . $VIMRUNTIME . '\diff"'
  32. else
  33. let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
  34. endif
  35. else
  36. let cmd = $VIMRUNTIME . '\diff'
  37. endif
  38. let cmd = substitute(cmd, '!', '\!', 'g')
  39. silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  40. if exists('l:shxq_sav')
  41. let &shellxquote=l:shxq_sav
  42. endif
  43. endfunction
  44.  
  45. set number
  46. set relativenumber
  47. set guifont=Hack_Nerd_Font_Mono:h12
  48. set autoindent
  49. set smartindent
  50. set cindent
  51. set tabstop=4
  52. set shiftwidth=4
  53. set clipboard=unnamed
  54. set encoding=utf-8
  55. set noswapfile
  56. set nobackup
  57. set noundofile
  58. set cursorline
  59.  
  60. inoremap { {}<Left>
  61. inoremap {<CR> {<CR>}<Esc>O
  62. inoremap {{ {
  63. inoremap {} {}
  64.  
  65.  
  66. :inoremap ( ()<ESC>i
  67. :inoremap ) <c-r>=ClosePair(')')<CR>
  68. :inoremap [ []<ESC>i
  69. :inoremap ] <c-r>=ClosePair(']')<CR>
  70.  
  71. function! ClosePair(char)
  72. if getline('.')[col('.') - 1] == a:char
  73. return "\<Right>"
  74. else
  75. return a:char
  76. endif
  77. endfunction
  78.  
  79. func! Run()
  80. exec "w"
  81. exec "!g++ -O2 -std=gnu++20 -Wall -Wextra -Wfatal-errors -o %<.exe %"
  82. endfunc
  83.  
  84. func! St()
  85. exec ":!%<.exe"
  86. endfunc
  87.  
  88. map <F3> :bnext<CR>
  89. map <F4> :w<CR>
  90. map <F2> :Explore<CR>
  91. map <F9> :call Run()<CR>
  92. map <F11> :!%< <
  93. map <F6> :CocRestart<CR>
  94. map <F8> :bd<CR>
  95. map <F5> :IndentLinesToggle<CR>
  96. inoremap <F10> #include <algorithm><CR>#include <iostream><CR>#include <cstring><CR>#include <cmath><CR><CR>typedef long long ll;<CR>typedef long double ld;<CR>typedef unsigned long long ull;<CR><CR>using namespace std;<CR><CR>const int INF = 0x3f3f3f3f;<CR><CR><CR>int main()<CR>{<CR>ios::sync_with_stdio(0);<CR>cin.tie(0);<CR><CR><CR><CR>return 0;<CR><ESC>i}<CR><ESC>i
  97.  
  98.  
  99. call plug#begin('~/vimfiles/plugged')
  100. Plug 'tomasiser/vim-code-dark'
  101. Plug 'vim-airline/vim-airline'
  102. Plug 'morhetz/gruvbox'
  103. Plug 'Yggdroot/indentLine'
  104. Plug 'preservim/tagbar'
  105. Plug 'vim-airline/vim-airline-themes'
  106. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  107. Plug 'christoomey/vim-tmux-navigator'
  108. Plug 'tomasiser/vim-code-dark'
  109. Plug 'letorbi/vim-colors-modern-borland'
  110. Plug 'jacoborus/tender.vim'
  111. Plug 'sainnhe/gruvbox-material'
  112. Plug 'joshdick/onedark.vim'
  113. Plug 'altercation/vim-colors-solarized'
  114. Plug 'crusoexia/vim-monokai'
  115. call plug#end()
  116.  
  117. set background=dark
  118.  
  119. colorscheme onedark
  120. set laststatus=2 "永远显示状态栏
  121. let g:airline_powerline_fonts = 1 " 支持 powerline 字体
  122. let g:airline#extensions#tabline#enabled = 1
  123.  
  124. augroup VIMRC
  125. au!
  126. au BufWritePost .vimrc so %
  127. augroup END
  128. set hidden
  129. set updatetime=100
  130. inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
  131. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  132.  
  133. "----缩进指示线 indentLine 配置 ----------
  134. let g:indentLine_enabled = 1
  135. let g:indentLine_char='┆'
  136.  
  137. set guifont=Hack\ Nerd\ Font\ Mono\ Italic:h12
  138.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement