REFACTOR: Merged templates into a per language file, deleted init.lua as
it was just a middle man and wasnt needed (in fact it is better without it) FT: Changes to python
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
function M.buf(bufnr, user_opts)
|
||||
bufnr = (bufnr == nil or bufnr == 0) and vim.api.nvim_get_current_buf()
|
||||
or bufnr
|
||||
local ft = vim.bo[bufnr].filetype
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
|
||||
user_opts = user_opts or {}
|
||||
|
||||
local default = require("vern.configs.default")
|
||||
|
||||
local lang_opts = (user_opts or {})[ft] or {}
|
||||
local final_opts =
|
||||
vim.tbl_deep_extend("force", {}, default, user_opts, lang_opts)
|
||||
final_opts[ft] = nil
|
||||
local ok, lang_attach = pcall(require, "vern.attach." .. ft) --- like a try / catch block in c++
|
||||
if ok and type(lang_attach) == "function" then
|
||||
lang_attach(bufnr, final_opts)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user