ps1xml.vim 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. " Vim filetype plugin file
  2. " Language: Windows PowerShell
  3. " URL: https://github.com/PProvost/vim-ps1
  4. " Last Change: 2021 Apr 02
  5. " 2024 Jan 14 by Vim Project (browsefilter)
  6. " 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
  7. " Only do this when not done yet for this buffer
  8. if exists("b:did_ftplugin") | finish | endif
  9. " Don't load another plug-in for this buffer
  10. let b:did_ftplugin = 1
  11. let s:cpo_save = &cpo
  12. set cpo&vim
  13. setlocal tw=0
  14. setlocal commentstring=#\ %s
  15. setlocal formatoptions=tcqro
  16. " Change the browse dialog on Win32 and GTK to show mainly PowerShell-related files
  17. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  18. let b:browsefilter =
  19. \ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
  20. \ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
  21. \ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
  22. \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n"
  23. if has("win32")
  24. let b:browsefilter .= "All Files (*.*)\t*\n"
  25. else
  26. let b:browsefilter .= "All Files (*)\t*\n"
  27. endif
  28. endif
  29. " Undo the stuff we changed
  30. let b:undo_ftplugin = "setlocal tw< cms< fo<" .
  31. \ " | unlet! b:browsefilter"
  32. let &cpo = s:cpo_save
  33. unlet s:cpo_save