From 16e9c61abdbdf1deb4ac96f265272ab9322b4dfb Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 3 Dec 2021 14:40:29 +0100 Subject: [PATCH] Split load_plugin_file into 2 functions --- home/.config/nvim/lua/plugins.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index 79ff1e7..aff900a 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -18,13 +18,18 @@ if fn.empty(fn.glob(plug_install_path)) > 0 then cmd[[autocmd VimEnter * PlugInstall]] end --- Load a .vim or .lua file containing Plug call(s) and plugin settings -local function load_plugin_file(plugin_file) - local extension = plugin_file:match("^.+(%..+)$") - local plugin_path = plugin_files_dir .. "/" .. plugin_file +-- Load an arbitrary .vim or .lua file +local function load_file(file_path) + local extension = file_path:match("^.+(%..+)$") local run_cmd if (extension == ".vim") then run_cmd = "source" else run_cmd = "luafile" end - fn.execute(run_cmd .. " " .. plugin_path) + fn.execute(run_cmd .. " " .. file_path) +end + +-- Load a file containing Plug call(s) and plugin settings +local function load_plugin_file(plugin_file) + local plugin_path = plugin_files_dir .. "/" .. plugin_file + load_file(plugin_path) end -- Load a single given plugin using a Plug call