Kevin_Zhang

clean vimrc

Oct 15th, 2021 (edited)
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.46 KB | None | 0 0
  1. set ar fdm=manual nu ts=2 sw=2 ai rnu
  2. sy on
  3.  
  4. function Run_cpp_from_clipboard()
  5.     !xclip -selection clipboard -o > /home/kevin/Documents/Code/inputf.txt &&
  6.     \clear &&
  7.     \printf "            input : \n" &&
  8.     \cat /home/kevin/Documents/Code/inputf.txt &&
  9.     \printf "\n\n            output : \n" &&
  10.     \~/run</home/kevin/Documents/Code/inputf.txt
  11. endfunction
  12.  
  13. function Build_cpp()
  14.     !g++ -DKEV -std=c++17 -fsanitize=undefined "%" -o ~/run
  15. endfunction
  16.  
  17. function Init_cpp()
  18.     noremap<leader>l :%d<bar>0r /home/kevin/Documents/Code/template.cpp<CR>:1,16fold<CR>
  19.     set cin
  20.     noremap <F7> :w<bar>call Build_cpp()<CR>
  21.     noremap <F8> :wa<bar>call Run_cpp_from_clipboard()<CR>
  22.     noremap <F9> :!~/run<CR>
  23.     noremap <C-p> I//<ESC>
  24. endfunction
  25.  
  26. function Init_python()
  27.     map <F7> :w<bar>!python '%'<CR>
  28.     map <F8> :w<bar>!python '%' <01.in<CR>
  29.     map <C-p> I#<esc>
  30. endfunction
  31.  
  32. function Init_latex()
  33.     map<F7> :wa<bar>!xelatex main.tex<CR>
  34.     map<F8> :!okular main.pdf & exit<CR>
  35.     map<C-p> I%<ESC>
  36. endfunction
  37.  
  38. function Init_c()
  39.     map<F7> :w<bar>!gcc -std=c11 -fsanitize=undefined "%" -o ~/run<CR>
  40. endfunction
  41.  
  42. au Bufenter *.cpp,*.c call Init_cpp()
  43. au BufNewFile *.cpp -r ~/Documents/Code/template.cpp
  44.  
  45. au Bufenter *.tex call Init_latex()
  46. au Bufenter *.py call Init_python()
  47. au Bufenter *.c call Init_c()
  48.  
  49. map <leader>p :%d<bar>0pu+<CR>
  50. map <leader>l :%d<bar>0r ~/t<CR>
  51. map <leader>b <F7>
  52. map <leader>r <F8>
  53. map <leader>i <F9>
  54. map <leader>c <C-p>
  55. map <leader>y :%y+<CR>
  56.  
Add Comment
Please, Sign In to add comment