vimrc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. " Vundle plugin manager
  2. set nocompatible
  3. filetype off
  4. set rtp+=~/.vim/bundle/Vundle.vim
  5. call vundle#begin()
  6. Plugin 'VundleVim/Vundle.vim'
  7. Plugin 'captbaritone/better-indent-support-for-php-with-html'
  8. call vundle#end()
  9. " Make hard tab look like 4 spaces tabs
  10. set shiftwidth=4
  11. set tabstop=4
  12. " When started as "evim", evim.vim will already have done these settings.
  13. if v:progname =~? "evim"
  14. finish
  15. endif
  16. " Use Vim settings, rather than Vi settings (much better!).
  17. " This must be first, because it changes other options as a side effect.
  18. " Avoid side effects when it was already reset.
  19. if &compatible
  20. set nocompatible
  21. endif
  22. " When the +eval feature is missing, the set command above will be skipped.
  23. " Use a trick to reset compatible only when the +eval feature is missing.
  24. silent! while 0
  25. set nocompatible
  26. silent! endwhile
  27. " Allow backspacing over everything in insert mode.
  28. set backspace=indent,eol,start
  29. set history=200
  30. set ruler
  31. set showcmd " display incomplete commands
  32. set wildmenu " display completion matches in a status line
  33. set ttimeout " time out for key codes
  34. set ttimeoutlen=100 " wait up to 100ms after Esc for special key
  35. " Show @@@ in the last line if it is truncated.
  36. set display=truncate
  37. " Show a few lines of context around the cursor. Note that this makes the
  38. " text scroll if you mouse-click near the start or end of the window.
  39. set scrolloff=5
  40. " Do incremental searching when it's possible to timeout.
  41. if has('reltime')
  42. set incsearch
  43. endif
  44. " Do not recognize octal numbers for Ctrl-A and Ctrl-X
  45. set nrformats-=octal
  46. " Don't use Ex mode, use Q for formatting.
  47. " Revert with ":unmap Q".
  48. map Q gq
  49. " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
  50. " so that you can undo CTRL-U after inserting a line break.
  51. " Revert with ":iunmap <C-U>".
  52. inoremap <C-U> <C-G>u<C-U>
  53. " Switch syntax highlighting on when available
  54. if &t_Co > 2 || has("gui_running")
  55. " Revert with ":syntax off".
  56. syntax on
  57. " I like highlighting strings inside C comments.
  58. " Revert with ":unlet c_comment_strings".
  59. let c_comment_strings=1
  60. endif
  61. " Only do this part when compiled with support for autocommands.
  62. if has("autocmd")
  63. " Enable file type detection.
  64. " Use the default filetype settings, so that mail gets 'tw' set to 72,
  65. " 'cindent' is on in C files, etc.
  66. " Also load indent files, to automatically do language-dependent indenting.
  67. " Revert with ":filetype off".
  68. filetype plugin indent on
  69. " Put these in an autocmd group, so that you can revert them with:
  70. " ":augroup vimStartup | au! | augroup END"
  71. augroup vimrcEx
  72. au!
  73. " When editing a file, always jump to the last known cursor position.
  74. " Don't do it when the position is invalid, when inside an event handler
  75. " (happens when dropping a file on gvim) and for a commit message (it's
  76. " likely a different one than last time).
  77. autocmd BufReadPost *
  78. \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
  79. \ | exe "normal! g`\""
  80. \ | endif
  81. " For all text files set 'textwidth' to 78 characters.
  82. autocmd FileType text setlocal textwidth=78
  83. augroup END
  84. else
  85. set autoindent " always set autoindenting on
  86. endif " has("autocmd")
  87. " Convenient command to see the difference between the current buffer and the
  88. " file it was loaded from, thus the changes you made.
  89. " Only define it when not defined already.
  90. " Revert with: ":delcommand DiffOrig".
  91. if !exists(":DiffOrig")
  92. command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
  93. \ | wincmd p | diffthis
  94. endif
  95. if has('langmap') && exists('+langremap')
  96. " Prevent that the langmap option applies to characters that result from a
  97. " mapping. If set (default), this may break plugins (but it's backward
  98. " compatible).
  99. set nolangremap
  100. endif
  101. set nobackup " do not keep a backup file, use versions instead
  102. if has('persistent_undo')
  103. set undofile " keep an undo file (undo changes after closing)
  104. set undodir=/tmp/
  105. endif
  106. " Add optional packages.
  107. "
  108. " The matchit plugin makes the % command work better, but it is not backwards
  109. " compatible.
  110. " The ! means the package won't be loaded right away but when plugins are
  111. " loaded during initialization.
  112. if has('syntax') && has('eval')
  113. packadd! matchit
  114. endif