blob: 9fcf87a759bdd6a6b6e1ae95766cc219f863137f [file] [log] [blame]
Bram Moolenaardf980db2017-12-24 13:22:00 +01001" Vim filetype plugin
2" Language: CMake
3" Maintainer: Keith Smiley <keithbsmiley@gmail.com>
Bram Moolenaar20aac6c2018-09-02 21:07:30 +02004" Last Change: 2018 Aug 30
Wu, Zhenyu564166f2024-04-20 17:53:08 +02005" 2024 Apr 20 - add include and suffixadd (Vim Project)
Bram Moolenaardf980db2017-12-24 13:22:00 +01006
7" Only do this when not done yet for this buffer
8if exists("b:did_ftplugin")
9 finish
10endif
11
Bram Moolenaar20aac6c2018-09-02 21:07:30 +020012" save 'cpo' for restoration at the end of this file
13let s:cpo_save = &cpo
14set cpo&vim
15
Bram Moolenaardf980db2017-12-24 13:22:00 +010016" Don't load another plugin for this buffer
17let b:did_ftplugin = 1
18
Wu, Zhenyu564166f2024-04-20 17:53:08 +020019let b:undo_ftplugin = "setl inc< sua< commentstring<"
Bram Moolenaardf980db2017-12-24 13:22:00 +010020
Bram Moolenaar20aac6c2018-09-02 21:07:30 +020021if exists('loaded_matchit')
22 let b:match_words = '\<if\>:\<elseif\>\|\<else\>:\<endif\>'
23 \ . ',\<foreach\>\|\<while\>:\<break\>:\<endforeach\>\|\<endwhile\>'
24 \ . ',\<macro\>:\<endmacro\>'
25 \ . ',\<function\>:\<endfunction\>'
26 let b:match_ignorecase = 1
27
28 let b:undo_ftplugin .= "| unlet b:match_words"
29endif
30
Wu, Zhenyu564166f2024-04-20 17:53:08 +020031setlocal include=\s*include
32setlocal suffixesadd=.cmake,-config.cmake
Bram Moolenaardf980db2017-12-24 13:22:00 +010033setlocal commentstring=#\ %s
Bram Moolenaar20aac6c2018-09-02 21:07:30 +020034
35" restore 'cpo' and clean up buffer variable
36let &cpo = s:cpo_save
37unlet s:cpo_save