Skip to content

Commit

Permalink
fix: add config/ft.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondill committed Jul 31, 2024
1 parent 2ebe5be commit 5eea448
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
18 changes: 2 additions & 16 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
require("future") -- Fowards compatability

-- Override .pluto and .tmpl extensions
vim.filetype.add({
pattern = {
[".*/etc/default/grub.d/.*%.cfg"] = "sh",
},
filename = {
["/etc/default/grub"] = "sh",
},
extension = {
[".pluto"] = "lua",
[".tmpl"] = function(path) return vim.fs.basename(path):match(".+%.(.+).tmpl$") end,
},
})

if vim.fn.has("nvim-0.9.0") == 0 then
vim.api.nvim_echo({
{ "This configurations requires Neovim >= 0.9.0\n", "ErrorMsg" },
Expand All @@ -24,6 +8,8 @@ if vim.fn.has("nvim-0.9.0") == 0 then
return
end

require("future") -- Fowards compatability

do -- delay notifications till vim.notify was replaced or after 500ms
local notifs, orig = {}, vim.notify
local function temp(...) table.insert(notifs, vim.F.pack_len(...)) end
Expand Down
24 changes: 24 additions & 0 deletions lua/config/ft.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local names = { "reminder", "todo" }
local extensions = { ".txt", ".md", "" }

for _, name in ipairs(names) do
for _, ext in ipairs(extensions) do
vim.filetype.add({
pattern = { ["%.?" .. name .. ext] = "markdown" },
})
end
end

-- Override .pluto and .tmpl extensions
vim.filetype.add({
pattern = {
[".*/etc/default/grub.d/.*%.cfg"] = "sh",
},
filename = {
["/etc/default/grub"] = "sh",
},
extension = {
[".pluto"] = "lua",
[".tmpl"] = function(path) return vim.fs.basename(path):match(".+%.(.+).tmpl$") end,
},
})

0 comments on commit 5eea448

Please sign in to comment.