vimrc 5.0 KB

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