vimrc 2.3 KB

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