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
|
-- if true, telekasten will be enabled when opening a note within the configured home
|
||||||
take_over_my_home = true,
|
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",
|
dailies = home .. "/" .. "daily",
|
||||||
weeklies = home .. "/" .. "weekly",
|
weeklies = home .. "/" .. "weekly",
|
||||||
templates = home .. "/" .. "templates",
|
templates = home .. "/" .. "templates",
|
||||||
@@ -877,8 +881,10 @@ local function find_files_sorted(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
picker_actions.post_open = function()
|
picker_actions.post_open = function()
|
||||||
|
if M.Cfg.auto_set_filetype then
|
||||||
vim.cmd("set ft=telekasten")
|
vim.cmd("set ft=telekasten")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
picker_actions.select_default = function(prompt_bufnr)
|
picker_actions.select_default = function(prompt_bufnr)
|
||||||
local ret = action_set.select(prompt_bufnr, "default")
|
local ret = action_set.select(prompt_bufnr, "default")
|
||||||
@@ -2384,11 +2390,14 @@ local function Setup(cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- for previewers to pick up our syntax, we need to tell plenary to override `.md` with our syntax
|
-- for previewers to pick up our syntax, we need to tell plenary to override `.md` with our syntax
|
||||||
|
if M.Cfg.auto_set_filetype then
|
||||||
filetype.add_file("telekasten")
|
filetype.add_file("telekasten")
|
||||||
|
end
|
||||||
-- setting the syntax moved into plugin/telekasten.vim
|
-- setting the syntax moved into plugin/telekasten.vim
|
||||||
-- and does not work
|
-- and does not work
|
||||||
|
|
||||||
if M.Cfg.take_over_my_home == true then
|
if M.Cfg.take_over_my_home == true then
|
||||||
|
if M.Cfg.auto_set_filetype then
|
||||||
vim.cmd(
|
vim.cmd(
|
||||||
"au BufEnter "
|
"au BufEnter "
|
||||||
.. M.Cfg.home
|
.. M.Cfg.home
|
||||||
@@ -2397,6 +2406,7 @@ local function Setup(cfg)
|
|||||||
.. " set ft=telekasten"
|
.. " set ft=telekasten"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if debug then
|
if debug then
|
||||||
print("Resulting config:")
|
print("Resulting config:")
|
||||||
|
|||||||
Reference in New Issue
Block a user