vimrc 2.2 KB

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