In LunarVIM config, what I would like is to create a new ftplugin
named log
with it’s associated syntax.
I’d like to have the filetype and syntax within a custom folder (~/.lvim
) under source control that it loaded by the default config.lua
.
Actually I have:
~/.config/lvim/config.lua
local custom_path = vim.env.HOME .. "/.lvim/?.lua"
package.path = package.path .. ";" .. custom_path
require(custom-config)
~/.lvim/custom-config.lua
require(xxxx) -- same folder xxxx.lua
require(yyyy) -- same folder yyyy.lua
This is an example of the log
file content (it’s logs so nothing really fancy):
[I] [TAG] This is an info level log
[T] [TAG_2] This is a trace level log
[E] [TAG] I think you figured this one out!
I have tried to create just a basic syntax file named log.vim
like this to easily see that it has been loaded:
if exists("b:current_syntax")
finish
endif
echom "Log syntax file loaded"
syn match line '^.*$'
highlight line ctermfg=red
let b:current_syntax = "log"
Right now it does not automatically detect all log files (code will be added towards that with also specific ftplugin) but I manually
set filetype=log` when I open such file.
If I am here, it is that, of course, my log.vim
is never loaded (messages
never shows my echom
).
I have tried to source ~/.lvim/log.vim
, it does output the echom
but the syntax does not work.
I have tried to put this file in multiple folders found during my research on how to add syntax
without any success (~/.config/nvim/after/syntax/log.vim
, ~/.lvim
).
These are my questions:
- How can I add syntax/ftplugin files in a custom folder and tell LunarVim to automatically load them ?
- Is my syntax file (this is just for “debugging”) valid ?