vimrc 2.3 KB

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