Advertisement
QinghaoHu

init.vim

Nov 24th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. lua require ('setting')
  2. set number
  3. set relativenumber
  4.  
  5. set showcmd
  6. set clipboard=unnamed
  7.  
  8. set mouse=a
  9.  
  10. set nobackup
  11. set noswapfile
  12. set noexpandtab
  13. set noundofile
  14.  
  15. set autoindent
  16. set tabstop=4
  17. set softtabstop=4
  18. set shiftwidth=4
  19.  
  20. set smartindent
  21. set syntax
  22.  
  23. call plug#begin()
  24. Plug 'morhetz/gruvbox'
  25. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  26. call plug#end()
  27. exec"PlugInstall"
  28. exec"CocRestart"
  29. "font
  30. set guifont=Hack\ Nerd\ Font\ Mono:h9
  31.  
  32. "colorscheme
  33. colorscheme gruvbox
  34.  
  35. "compile
  36.  
  37.  
  38. func! Run()
  39. exec "w"
  40. exec "!g++ -O2 -std=gnu++14 -Wall -Wextra -Wfatal-errors -o %<.exe %"
  41. endfunc
  42.  
  43. "auto-pairs
  44. :inoremap " ""<ESC>i
  45. :inoremap ' ''<ESC>i
  46. inoremap { {}<Left>
  47. inoremap {<CR> {<CR>}<Esc>O
  48. inoremap {{ {
  49. inoremap {} {}
  50.  
  51.  
  52. :inoremap ( ()<ESC>i
  53. :inoremap ) <c-r>=ClosePair(')')<CR>
  54. :inoremap [ []<ESC>i
  55. :inoremap ] <c-r>=ClosePair(']')<CR>
  56.  
  57. function! ClosePair(char)
  58. if getline('.')[col('.') - 1] == a:char
  59. return "\<Right>"
  60. else
  61. return a:char
  62. endif
  63. endfunction
  64.  
  65. "Keymaps
  66. map <F2> :NvimTreeToggle<CR>
  67. map <F3> :bp<CR>
  68. map <F4> :w<CR>
  69. map <F6> :CocRestart<CR>
  70. map <F8> :bd<CR>
  71. map <F9> :call Run()<CR>
  72. map <F11> :!%<.exe<CR>
  73.  
  74. "template
  75. inoremap <F10> #include <algorithm><CR>#include <cstring><CR>#include <cmath><CR>#include <iostream><CR><CR>typedef long long ll;<CR>typedef unsigned long long ull;<CR>typedef long double ld;<CR><CR>using namespace std;<CR><CR><CR>int main()<CR>{<CR>ios::sync_with_stdio(false);<CR>cin.tie(nullptr);<CR><CR><CR><CR><CR><ESC>i<TAB>return 0;<CR>}<ESC>
  76.  
  77. "Coc
  78. inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
  79. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  80. set hidden
  81. set updatetime=100
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement