From 66e2904b68de748b603681ac948a7944a59e45a9 Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Mon, 15 Aug 2022 19:42:27 +0900 Subject: [PATCH] format with stylua --- lua/core/lazy_load.lua | 124 ++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 7f7a6b6..aae71da 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -5,27 +5,27 @@ local autocmd = vim.api.nvim_create_autocmd -- This must be used for plugins that need to be loaded just after a file -- ex : treesitter, lspconfig etc M.lazy_load = function(tb) - autocmd(tb.events, { - group = vim.api.nvim_create_augroup(tb.augroup_name, {}), - callback = function() - if tb.condition() then - vim.api.nvim_del_augroup_by_name(tb.augroup_name) + autocmd(tb.events, { + group = vim.api.nvim_create_augroup(tb.augroup_name, {}), + callback = function() + if tb.condition() then + vim.api.nvim_del_augroup_by_name(tb.augroup_name) - -- dont defer for treesitter as it will show slow highlighting - -- This deferring only happens only when we do "nvim filename" - if tb.plugin ~= "nvim-treesitter" then - vim.defer_fn(function() - require("packer").loader(tb.plugin) - if tb.plugin == "nvim-lspconfig" then - vim.cmd("silent! do FileType") - end - end, 0) - else - require("packer").loader(tb.plugin) - end - end - end, - }) + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if tb.plugin ~= "nvim-treesitter" then + vim.defer_fn(function() + require("packer").loader(tb.plugin) + if tb.plugin == "nvim-lspconfig" then + vim.cmd "silent! do FileType" + end + end, 0) + else + require("packer").loader(tb.plugin) + end + end + end, + }) end -- load certain plugins only when there's a file opened in the buffer @@ -33,60 +33,60 @@ end -- This gives an instant preview of nvim with the file opened M.on_file_open = function(plugin_name) - M.lazy_load({ - events = { "BufRead", "BufWinEnter", "BufNewFile" }, - augroup_name = "BeLazyOnFileOpen" .. plugin_name, - plugin = plugin_name, - condition = function() - local file = vim.fn.expand("%") - return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" - end, - }) + M.lazy_load { + events = { "BufRead", "BufWinEnter", "BufNewFile" }, + augroup_name = "BeLazyOnFileOpen" .. plugin_name, + plugin = plugin_name, + condition = function() + local file = vim.fn.expand "%" + return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" + end, + } end M.packer_cmds = { - "PackerSnapshot", - "PackerSnapshotRollback", - "PackerSnapshotDelete", - "PackerInstall", - "PackerUpdate", - "PackerSync", - "PackerClean", - "PackerCompile", - "PackerStatus", - "PackerProfile", - "PackerLoad", + "PackerSnapshot", + "PackerSnapshotRollback", + "PackerSnapshotDelete", + "PackerInstall", + "PackerUpdate", + "PackerSync", + "PackerClean", + "PackerCompile", + "PackerStatus", + "PackerProfile", + "PackerLoad", } M.treesitter_cmds = { - "TSInstall", - "TSBufEnable", - "TSBufDisable", - "TSEnable", - "TSDisable", - "TSModuleInfo", + "TSInstall", + "TSBufEnable", + "TSBufDisable", + "TSEnable", + "TSDisable", + "TSModuleInfo", } M.mason_cmds = { - "Mason", - "MasonInstall", - "MasonInstallAll", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", + "Mason", + "MasonInstall", + "MasonInstallAll", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", } M.gitsigns = function() - autocmd({ "BufRead" }, { - callback = function() - vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand("%:p:h")) - if vim.v.shell_error == 0 then - vim.schedule(function() - require("packer").loader("gitsigns.nvim") - end) - end - end, - }) + autocmd({ "BufRead" }, { + callback = function() + vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand "%:p:h") + if vim.v.shell_error == 0 then + vim.schedule(function() + require("packer").loader "gitsigns.nvim" + end) + end + end, + }) end return M