vimrc 2.4 KB

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