vimrc 2.3 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. " Source the vimrc file after saving it
  12. autocmd! bufwritepost .vimrc source $MYVIMRC
  13. """"""""
  14. "" Formatting
  15. """"""""""""""""""""""""""""""""""""""""""""""""""""""
  16. set tabstop=4 "actual tab presses
  17. set shiftwidth=4 "for autoindent
  18. set softtabstop=4 " let backspace delete indent
  19. set expandtab "change to single spaces
  20. set autoindent "use last line to set next indent
  21. set smartindent "guess harder, based on C-like language
  22. set nowrap "do not wrap long lines of text
  23. """"""""
  24. "" UI - Colours
  25. """"""""""""""""""""""""""""""""""""""""""""""""""""""
  26. syntax on
  27. colorscheme desert
  28. hi Folded ctermfg=darkred "set colour for folded lines
  29. if version >= 730
  30. set colorcolumn=80
  31. endif
  32. """"""""
  33. "" UI - Numbering
  34. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  35. set number "show line numbers
  36. set ruler "show row,col count in status line
  37. if version >= 730
  38. set relativenumber "current line always 0 (requires 7.3 and up)
  39. endif
  40. """"""""
  41. "" UI - Code Folding
  42. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  43. set foldmethod=indent
  44. set foldlevel=5
  45. set foldtext=MyFoldText()
  46. function! MyFoldText()
  47. let line = getline(v:foldstart)
  48. let indent = indent(v:foldstart)
  49. let indentOnly = strpart(line, 0, indent-1)
  50. let linecount = v:foldend+1 - v:foldstart
  51. let plural = ""
  52. if linecount != 1
  53. let plural = "s"
  54. endif
  55. let foldtext = '+'.indentOnly.'... ('.linecount.' More lines)'
  56. return foldtext
  57. endfunction
  58. """"""""
  59. "" UI - Search
  60. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  61. set hlsearch "make searches highlighted
  62. set incsearch "vim will search as you type!
  63. """"""""
  64. "" Key Remaps and Shortcuts
  65. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  66. let mapleader = "," "Leader key lets you make more kinds of shortcuts!
  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-