Files
modules/contrib/vim/ftplugin/modulefile.vim
Xavier Delaruelle 204b1faf28 vim: fix and simplify modulefile highlight files
Improve vim files to detect and highlight modulefiles:

* add standard header information (like other files of this kind)
* add vim options to edit these files at the footer
* use regular method to base on Tcl syntax highlight to define
  modulefile syntax highlight (runtime command)
* add protection code to quit when syntax file has already been loaded
* define modulefile strings to highlight with "syn keyword" rather match
  for simpler syntax and better priority
* sort modulefile keywords with alphabetical order
* fix highlight of keywords containing a dash (-) character by adding
  this character to the iskeyword configuration option
* use generic "Special" vim highlight keyword rather rely on a
  Tcl-specific one
* remove redefinition of Tcl keywords as this is not needed anymore
  after the above changes
2023-09-02 09:22:49 +02:00

31 lines
795 B
VimL

" Vim filetype plugin file
" Language: Tcl Modulefile
" Maintainer: Xavier Delaruelle <xavier.delaruelle@cea.fr>
" Original: Felix Neumärker <xdch47@posteo.de>
" Reference: https://modules.readthedocs.io/en/latest/modulefile.html
if exists("b:did_modulefile_ftplugin")
finish
endif
let b:did_modulefile_ftplugin = 1
set syntax=modulefile
" adopted from tcl ftplugin:
let s:cpo_save = &cpo
set cpo-=C
setlocal comments=:#
setlocal commentstring=#%s
setlocal formatoptions+=croql
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp<" .
\ " | unlet! b:browsefilter"
" Restore the saved compatibility options.
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set tabstop=4 shiftwidth=4 expandtab textwidth=100: