vimrc 4.7 KB

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