diff.vim 852 B

123456789101112131415161718192021222324252627282930
  1. " Vim filetype plugin file
  2. " Language: Diff
  3. " Maintainer: The Vim Project <https://github.com/vim/vim>
  4. " Last Change: 2023 Aug 22
  5. " Former Maintainer: Bram Moolenaar <Bram@vim.org>
  6. " Only do this when not done yet for this buffer
  7. if exists("b:did_ftplugin")
  8. finish
  9. endif
  10. let b:did_ftplugin = 1
  11. let b:undo_ftplugin = "setl modeline< commentstring<"
  12. " Don't use modelines in a diff, they apply to the diffed file
  13. setlocal nomodeline
  14. " If there are comments they start with #
  15. let &l:commentstring = "# %s"
  16. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  17. let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\n"
  18. if has("win32")
  19. let b:browsefilter ..= "All Files (*.*)\t*\n"
  20. else
  21. let b:browsefilter ..= "All Files (*)\t*\n"
  22. endif
  23. let b:undo_ftplugin ..= " | unlet! b:browsefilter"
  24. endif