alker0 / chezmoi.vim

Highlight dotfiles you manage with chezmoi.
Other
119 stars 3 forks source link

Is it possible to autodetect ~/.config/conky/conky.conf as a lua file? #78

Open vbrand1984 opened 2 months ago

vbrand1984 commented 2 months ago

As the title says. I have a templated conky.conf.tmpl, the plugin makes a reasonable suggestion that this is a chezmoi template file, but the truth is, conky config is written in lua, and this should be lua.chezmoitmpl, as far as I get it.

After enabling this plugin, my own makeshift autocmd rules in vimrc cease to work, alas.

alker0 commented 2 months ago

Making your autocmd rules that detects file type belong in the filetypedetect group could make it work for you because this plugin runs all autocmds only belonging in the filetypedetect group as that should include all autocmds that detects file type.

For example, editing your .vimrc or .vim/vimrc as follows should fix it:

"autocmd BufRead,BufNewFile *conky.conf setlocal filetype=lua
augroup filetypedetect
  autocmd! BufRead,BufNewFile *conky.conf setfiletype lua
augroup END

Or making .vim/filetype.vim with these contents this should also work:

if exists('did_load_filetypes')
  finish
endif

augroup filetypedetect
  autocmd! BufRead,BufNewFile *conky.conf setfiletype lua
augroup END

You can see more details at vimhelp.org.