vimrc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. """"""""
  2. "" General Behaviours
  3. """""""""""""""""""""""""""""""""""""""""""""""""""
  4. set nocompatible "Don't have to try to be compatible with old vi
  5. set autoread "Read a file if it's changed from outside of vim
  6. let mapleader = "," "Leader key lets you make more kinds of shortcuts!
  7. " Source the vimrc file after saving it
  8. autocmd! bufwritepost .vimrc source $MYVIMRC
  9. """"""""
  10. "" Tabbing
  11. """"""""""""""""""""""""""""""""""""""""""""""""""""""
  12. set tabstop=4 "actual tab presses
  13. set shiftwidth=4 "for autoindent
  14. set expandtab "change to single spaces
  15. set smarttab
  16. set autoindent "use last line to set next indent
  17. set smartindent "guess harder, based on C-like language
  18. " set wrap "wrap lines of text
  19. """"""""
  20. "" UI - Colours
  21. """"""""""""""""""""""""""""""""""""""""""""""""""""""
  22. syntax on
  23. colorscheme desert
  24. set colorcolumn=80
  25. hi Folded ctermfg=darkred "set colour for folded lines
  26. """"""""
  27. "" UI - Numbering
  28. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  29. set number "show line numbers
  30. set relativenumber "current line always 0 (requires 7.3 and up)
  31. set ruler "show row,col count in status line
  32. """"""""
  33. "" UI - Code Folding
  34. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  35. set foldmethod=indent
  36. set foldlevel=1
  37. set foldtext=MyFoldText()
  38. function! MyFoldText()
  39. let line = getline(v:foldstart)
  40. let linecount = v:foldend+1 - v:foldstart
  41. let plural = ""
  42. if linecount != 1
  43. let plural = "s"
  44. endif
  45. let foldtext = '+'.line.'... ('.linecount.' More lines)'
  46. return foldtext
  47. endfunction
  48. """"""""
  49. "" UI - Search
  50. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  51. set hlsearch "make searches highlighted
  52. set incsearch "vim will search as you type!
  53. """"""""
  54. "" Shortcuts
  55. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  56. " More convenient escape
  57. imap ii <Esc>
  58. imap II <Esc>
  59. " Add extra lines up and down
  60. map <leader>j o<Esc>k
  61. map <leader>k O<Esc>j
  62. " window resizing
  63. noremap + <C-w>10+
  64. noremap - <C-w>10-