diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-08 23:13:05 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-08 23:13:05 +0100 |
commit | c9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 (patch) | |
tree | 274263ba15e0197180af8bb681e22c4780d5de05 /.config/nvim/lua/utils | |
parent | e4ea22e223bbd6b4091610c6fa093862cbd32f75 (diff) |
Add new lunarvin updates
Diffstat (limited to '.config/nvim/lua/utils')
-rw-r--r-- | .config/nvim/lua/utils/ft.lua | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/.config/nvim/lua/utils/ft.lua b/.config/nvim/lua/utils/ft.lua deleted file mode 100644 index e9852e6..0000000 --- a/.config/nvim/lua/utils/ft.lua +++ /dev/null @@ -1,47 +0,0 @@ --- Here be dragons --- Opening files with telescope will not start LSP without this -local ft = {} - -ft.find_lua_ftplugins = function(filetype) - local patterns = { - string.format("ftplugin/%s.lua", filetype), - - -- Looks like we don't need this, because the first one works - -- string.format("after/ftplugin/%s.lua", filetype), - } - - local result = {} - for _, pat in ipairs(patterns) do - vim.list_extend(result, vim.api.nvim_get_runtime_file(pat, true)) - end - - return result -end - -ft.do_filetype = function(filetype) - local ftplugins = ft.find_lua_ftplugins(filetype) - - local f_env = setmetatable({ - -- Override print, so the prints still go through, otherwise it's confusing for people - print = vim.schedule_wrap(print), - }, { - -- Buf default back read/write to whatever is going on in the global landscape - __index = _G, - __newindex = _G, - }) - - for _, file in ipairs(ftplugins) do - local f = loadfile(file) - if not f then - vim.api.nvim_err_writeln("Unable to load file: " .. file) - else - local ok, msg = pcall(setfenv(f, f_env)) - - if not ok then - vim.api.nvim_err_writeln("Error while processing file: " .. file .. "\n" .. msg) - end - end - end -end - -return ft |