mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
fix #49: set new option auto_set_filetype to false if you don't like
the telekasten filetype
This commit is contained in:
@@ -35,6 +35,10 @@ M.Cfg = {
|
||||
-- if true, telekasten will be enabled when opening a note within the configured home
|
||||
take_over_my_home = true,
|
||||
|
||||
-- auto-set telekasten filetype: if false, the telekasten filetype will not be used
|
||||
-- and thus the telekasten syntax will not be loaded either
|
||||
auto_set_filetype = true,
|
||||
|
||||
dailies = home .. "/" .. "daily",
|
||||
weeklies = home .. "/" .. "weekly",
|
||||
templates = home .. "/" .. "templates",
|
||||
@@ -877,7 +881,9 @@ local function find_files_sorted(opts)
|
||||
end
|
||||
|
||||
picker_actions.post_open = function()
|
||||
vim.cmd("set ft=telekasten")
|
||||
if M.Cfg.auto_set_filetype then
|
||||
vim.cmd("set ft=telekasten")
|
||||
end
|
||||
end
|
||||
|
||||
picker_actions.select_default = function(prompt_bufnr)
|
||||
@@ -2384,18 +2390,22 @@ local function Setup(cfg)
|
||||
}
|
||||
|
||||
-- for previewers to pick up our syntax, we need to tell plenary to override `.md` with our syntax
|
||||
filetype.add_file("telekasten")
|
||||
if M.Cfg.auto_set_filetype then
|
||||
filetype.add_file("telekasten")
|
||||
end
|
||||
-- setting the syntax moved into plugin/telekasten.vim
|
||||
-- and does not work
|
||||
|
||||
if M.Cfg.take_over_my_home == true then
|
||||
vim.cmd(
|
||||
"au BufEnter "
|
||||
.. M.Cfg.home
|
||||
.. "/*"
|
||||
.. M.Cfg.extension
|
||||
.. " set ft=telekasten"
|
||||
)
|
||||
if M.Cfg.auto_set_filetype then
|
||||
vim.cmd(
|
||||
"au BufEnter "
|
||||
.. M.Cfg.home
|
||||
.. "/*"
|
||||
.. M.Cfg.extension
|
||||
.. " set ft=telekasten"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
if debug then
|
||||
|
||||
Reference in New Issue
Block a user