diff --git a/rc/c-family.kak b/rc/c-family.kak index 1e0bf1c4..a033ac10 100644 --- a/rc/c-family.kak +++ b/rc/c-family.kak @@ -145,8 +145,19 @@ hook global WinSetOption filetype=(?!cpp$).* %[ rmhl cpp ] hook global WinSetOption filetype=objc %[ addhl ref objc ] hook global WinSetOption filetype=(?!objc$).* %[ rmhl objc ] +decl str c_include_guard_style "ifdef" def -hidden _c-family-insert-include-guards %{ - exec ggi%ggxs\.c_A_INCLUDEDggxyppI#ifndefjI#definejI#endif//O + %sh{ + case "${kak_opt_c_include_guard_style,,}" in + ifdef) + echo "exec ggi%ggxs\.c_A_INCLUDEDggxyppI#ifndefjI#definejI#endif//O" + ;; + pragma) + echo "exec ggi#pragmaonce" + ;; + *);; + esac + } } hook global BufNew .*\.(h|hh|hpp|hxx|H) _c-family-insert-include-guards