Advertisement
tdcr

Vim setup

May 31st, 2023 (edited)
2,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.36 KB | None | 0 0
  1. syntax on
  2. set incsearch
  3. set number
  4. set nobackup
  5. set smartindent
  6. set nowrap
  7. set mouse=a
  8. set shiftwidth=4
  9. set ruler       " bottom-left showing current row col position
  10.  
  11. filetype indent on
  12.  
  13.  
  14. "set line number colors
  15. hi CursorLineNr cterm=bold ctermfg=Green ctermbg=NONE
  16. " underline cursor line and mark line color green
  17. hi LineNr cterm=bold ctermfg=DarkGrey ctermbg=NONE
  18.  
  19.  
  20. "mapping rules
  21.  
  22. " when enter '{', vim will generate {\n}\n, 'k' curosr goes up, 'o' auto insert newline
  23. inoremap {<CR> {<CR>}<Esc>ko
  24. "  'i' means enter insert mode
  25. inoremap ( ()<Esc>i
  26. " "", '' and <> >mapping
  27. inoremap " ""<Esc>i
  28. inoremap ' ''<Esc>i
  29. inoremap < <><Esc>i
  30.  
  31.  
  32.  
  33. " Color configuration
  34. set bg=dark
  35. color evening  " Same as :colorscheme eveni:
  36.  
  37. " ggVG to ctrl-a in vim, gg goes to the top of a file, V goes to visual mode, G goes to end of file
  38.  
  39.  
  40.  
  41. " auto run python with f9
  42. autocmd FileType python map <buffer> <F9> :w<CR>:exec '!python3' shellescape(@%, 1)<CR>
  43. autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!python3' shellescape(@%, 1)<CR>
  44.  
  45. " auto gcc/g++ and execute f5 (not working)
  46. " autocmd FileType c map <buffer> <F5> :w<CR>:exec '!gcc' shellescape(@%, 1) '-o' shellescape(@%, 1:r) && './'.shellescape(@%, 1:r)<CR>
  47. " autocmd FileType c++ map <buffer> <F5> :w<CR>:exec '!g++' shellescape(@%, 1) '-o' shellescape(@%, 1:r) && './'.shellescape(@%, 1:r)<CR>
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement