vimrc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. """"""""
  2. "" Plugin Loading with Pathogen
  3. """""""""""""""""""""""""""""""""""""""""""""""""""
  4. call pathogen#infect()
  5. """"""""
  6. "" General Behaviours
  7. """""""""""""""""""""""""""""""""""""""""""""""""""
  8. set nocompatible "Don't have to try to be compatible with old vi
  9. set autoread "Read a file if it's changed from outside of vim
  10. if version >= 700
  11. set mouse=a "mouse support for 7.x
  12. endif
  13. " Source the vimrc file after saving it
  14. autocmd! bufwritepost .vimrc source $MYVIMRC
  15. """"""""
  16. "" Formatting
  17. """"""""""""""""""""""""""""""""""""""""""""""""""""""
  18. set tabstop=4 "actual tab press distance
  19. set shiftwidth=4 "for autoindent
  20. set softtabstop=4 " let backspace delete indent
  21. set expandtab "change to single spaces
  22. set autoindent "use last line to set next indent
  23. set smartindent "guess harder, based on C-like language
  24. set nowrap "do not wrap long 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. set ignorecase
  66. """"""""
  67. "" Key Remaps and Shortcuts
  68. """"""""""""""""""""""""""""""""""""""""""""""""""""""""
  69. let mapleader = "," "Leader key lets you make more kinds of shortcuts!
  70. " More convenient escape
  71. imap ii <Esc>
  72. imap II <Esc>
  73. " Add extra lines up and down
  74. map <leader>j o<Esc>k
  75. map <leader>k O<Esc>j
  76. " window resizing
  77. noremap + <C-w>10+
  78. noremap - <C-w>10-