Advertisement
QinghaoHu

macvimrc

Dec 30th, 2023
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1.  
  2. set modelines=0 " CVE-2007-2438
  3.  
  4. " Normally we use vim-extensions. If you want true vi-compatibility
  5. " remove change the following statements
  6. set nocompatible " Use Vim defaults instead of 100% vi compatibility
  7. set backspace=2 " more powerful backspacing
  8.  
  9. " Don't write backup file if vim is being called by "crontab -e"
  10. au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
  11. " Don't write backup file if vim is being called by "chpass"
  12. au BufWrite /private/etc/pw.* set nowritebackup nobackup
  13.  
  14. let skip_defaults_vim=1
  15.  
  16. set autoindent
  17.  
  18.  
  19. set ts=4
  20. set sw=4
  21. set showcmd
  22. set showmode
  23. set clipboard=unnamed
  24.  
  25. set mouse=a
  26.  
  27. set noswapfile
  28. set nobackup
  29. set nocompatible
  30. set cursorline
  31.  
  32. syntax on
  33. set number
  34.  
  35. map <F2> :Explore<CR>
  36. map <F4> :w<CR>
  37. map <F3> :bnext<CR>
  38. map <F5> :IndentLinesToggle<CR>
  39. map <F9> :call Run()<CR>
  40. map <F11> :!./%< <
  41. map <F7> :call Rnjava()<CR>
  42.  
  43. func! Rnjava()
  44. exec "w"
  45. exec "!javac %"
  46. endfunc
  47.  
  48. func! Run()
  49. exec "w"
  50. exec "!g++-13 -O3 -std=gnu++20 -Wall -Wfatal-errors -o %< %"
  51. endfunc
  52.  
  53. func! ST()
  54. exec "w"
  55. exec "! ./%<"
  56. endfunc
  57.  
  58.  
  59. set guifont=Hack\ Nerd\ Font\ Mono\ Italic:h14
  60.  
  61. inoremap {<CR> {<CR>}<Esc>O
  62. inoremap { {}<ESC>i
  63.  
  64.  
  65. set nu
  66.  
  67. 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(false);<CR>cin.tie(nullptr);<CR><CR><CR><CR>return 0;<CR><ESC>i}
  68. inoremap <F12> void setOI(string s){<CR>freopen((s + ".in").c_str(), "r", stdin);<CR>freopen((s + ".out").c_str(), "w", stdout);<CR><ESC>i}<CR>
  69.  
  70.  
  71. set relativenumber
  72.  
  73. :inoremap ( ()<ESC>i
  74. :inoremap ) <c-r>=ClosePair(')')<CR>
  75. :inoremap [ []<ESC>i
  76. :inoremap ] <c-r>=ClosePair(']')<CR>
  77. function! ClosePair(char)
  78. if getline('.')[col('.') - 1] == a:char
  79. return "\<Right>"
  80. else
  81. return a:char
  82. endif
  83. endfunction
  84.  
  85.  
  86. "Plugin
  87. call plug#begin()
  88. Plug 'preservim/nerdtree'
  89. Plug 'tomasiser/vim-code-dark'
  90. Plug 'vim-airline/vim-airline'
  91. Plug 'majutsushi/tagbar'
  92. Plug 'mhinz/vim-startify'
  93. Plug 'vim-airline/vim-airline-themes'
  94. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  95. Plug 'morhetz/gruvbox'
  96. Plug 'christoomey/vim-tmux-navigator'
  97. Plug 'tomasiser/vim-code-dark'
  98. Plug 'letorbi/vim-colors-modern-borland'
  99. Plug 'doums/darcula'
  100. Plug 'jacoborus/tender.vim'
  101. Plug 'sainnhe/gruvbox-material'
  102. Plug 'joshdick/onedark.vim'
  103. Plug 'crusoexia/vim-monokai'
  104. call plug#end()
  105.  
  106. set background=dark
  107.  
  108. "colorscheme gruvbox-material
  109. colorscheme onedark
  110.  
  111. set termguicolors
  112. set t_Co=256
  113.  
  114. let g:gruvbox_material_background = 'material'
  115.  
  116. set laststatus=2
  117. let g:airline_powerline_fonts = 1
  118. let g:airline#extensions#tabline#enabled = 1
  119.  
  120. nmap <F8> :bd<CR>
  121. nmap <F6> :CocRestart<CR>
  122.  
  123. set hidden
  124. set updatetime=300
  125. inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
  126. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  127. let g:indentLine_char = '┊'
  128.  
  129.  
  130. augroup VIMRC
  131. au!
  132. au BufWritePost .vimrc so %
  133. augroup END
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement