yorokobi / vim-splunk

Syntax highlighting for Splunk .conf files
http://yorokobi.github.io/vim-splunk/
The Unlicense
74 stars 20 forks source link

limits.conf syntax highlighting not working with Vim 8.2 #15

Closed yorokobi closed 3 years ago

yorokobi commented 4 years ago

The following line in /usr/share/vim/vim82/filetype.vim affects whether this project's spl_limits.vim file is applied to limits.conf when created/edited in $SPLUNK_HOME/etc/* :

au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf    setf limits
yorokobi commented 4 years ago

Changing the /usr/share/vim/vim82/filetype.vim line to:

au BufNewFile,BufRead */etc/limits,*/etc/*limits.d/*.conf    setf limits

... will restore the expected behaviour for this project but that is not a sustainable solution as the file will be changed with the next Vim upgrade.

yorokobi commented 4 years ago

Adding this line to limits.conf will ensure the correct filetype is used.

# vim: set ft=spl_limits :

https://vimhelp.org/filetype.txt.html#filetype.txt indicates that Vim loads $VIMRUNTIME/filetypes.vim before user-created/ft-plugin definitions.

Adding an au! line to vim-splunk/ftdetect/splunk.vim will remove the one entry in $VIMRUNTIME/filetypes.vim that affects vim-splunk's limits.conf filetype detection:

au! BufNewFile,BufRead */etc/*limits.conf
au BufNewFile, BufRead */etc/system/local/limits.conf,*/etc/apps/*limits.conf