dosbatch.vim 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. " Vim filetype plugin file
  2. " Language: MS-DOS/Windows .bat files
  3. " Maintainer: Mike Williams <mrmrdubya@gmail.com>
  4. " Last Change: 12th February 2023
  5. " 2024 Jan 14 by Vim Project (browsefilter)
  6. "
  7. " Options Flags:
  8. " dosbatch_colons_comment - any value to treat :: as comment line
  9. " Only do this when not done yet for this buffer
  10. if exists("b:did_ftplugin")
  11. finish
  12. endif
  13. " Don't load another plugin for this buffer
  14. let b:did_ftplugin = 1
  15. let s:cpo_save = &cpo
  16. set cpo&vim
  17. " BAT comment formatting
  18. setlocal comments=b:rem,b:@rem,b:REM,b:@REM
  19. if exists("dosbatch_colons_comment")
  20. setlocal comments+=:::
  21. setlocal commentstring=::\ %s
  22. else
  23. setlocal commentstring=REM\ %s
  24. endif
  25. setlocal formatoptions-=t formatoptions+=rol
  26. " Lookup DOS keywords using Windows command help.
  27. if executable('help.exe')
  28. if has('terminal')
  29. setlocal keywordprg=:term\ help.exe
  30. else
  31. setlocal keywordprg=help.exe
  32. endif
  33. endif
  34. " Define patterns for the browse file filter
  35. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  36. let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\n"
  37. if has("win32")
  38. let b:browsefilter ..= "All Files (*.*)\t*\n"
  39. else
  40. let b:browsefilter ..= "All Files (*)\t*\n"
  41. endif
  42. endif
  43. let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<"
  44. \ . "| unlet! b:browsefilter"
  45. let &cpo = s:cpo_save
  46. unlet s:cpo_save