sudoers.vim 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. " Vim filetype plugin file
  2. " Language: sudoers(5) configuration files
  3. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  4. " Latest Revision: 2023-10-07
  5. if exists("b:did_ftplugin")
  6. finish
  7. endif
  8. let b:did_ftplugin = 1
  9. let s:cpo_save = &cpo
  10. set cpo&vim
  11. let b:undo_ftplugin = "setl com< cms< fo<"
  12. setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
  13. if has('unix') && executable('less')
  14. if !has('gui_running')
  15. command -buffer -nargs=1 SudoersKeywordPrg
  16. \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''\b' . <q-args> . '\b'' --hilite-search" man ' . 'sudoers' |
  17. \ redraw!
  18. elseif has('terminal')
  19. command -buffer -nargs=1 SudoersKeywordPrg
  20. \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers'
  21. endif
  22. if exists(':SudoersKeywordPrg') == 2
  23. setlocal iskeyword+=-
  24. setlocal keywordprg=:SudoersKeywordPrg
  25. let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg'
  26. endif
  27. endif
  28. let &cpo = s:cpo_save
  29. unlet s:cpo_save