From fab9f1bde2385469faff3420ee82cd8fa60770ad Mon Sep 17 00:00:00 2001 From: vhyrro Date: Thu, 22 Feb 2024 14:58:04 +0000 Subject: [PATCH] chore: autoformat with stylua --- lua/neorg/modules/core/clipboard/module.lua | 18 +++---- lua/neorg/modules/core/export/module.lua | 58 +++++++-------------- lua/neorg/modules/core/keybinds/module.lua | 9 ++-- lua/neorg/modules/core/ui/module.lua | 3 +- lua/neorg/modules/core/upgrade/module.lua | 4 +- 5 files changed, 34 insertions(+), 58 deletions(-) diff --git a/lua/neorg/modules/core/clipboard/module.lua b/lua/neorg/modules/core/clipboard/module.lua index 5b32893cb..7d26efee1 100644 --- a/lua/neorg/modules/core/clipboard/module.lua +++ b/lua/neorg/modules/core/clipboard/module.lua @@ -48,17 +48,13 @@ module.load = function() return callback.cb( node, - vim.split( - assert(register --[[@as string]]), - "\n", - { - plain = true, - -- TODO: This causes problems in places - -- where you actually want to copy - -- newlines. - trimempty = true, - } - ), + vim.split(assert(register --[[@as string]]), "\n", { + plain = true, + -- TODO: This causes problems in places + -- where you actually want to copy + -- newlines. + trimempty = true, + }), { start = range[1], ["end"] = range[2], diff --git a/lua/neorg/modules/core/export/module.lua b/lua/neorg/modules/core/export/module.lua index 245307845..4529acbef 100644 --- a/lua/neorg/modules/core/export/module.lua +++ b/lua/neorg/modules/core/export/module.lua @@ -223,29 +223,16 @@ module.on_event = function(event) local filetype = event.content[2] or vim.filetype.match({ filename = filepath }) local exported = module.public.export(event.buffer, filetype) - vim.loop.fs_open( - filepath, - "w", - 438, - function(err, fd) - assert(not err, lib.lazy_string_concat("Failed to open file '", filepath, "' for export: ", err)) - assert(fd) - - vim.loop.fs_write( - fd, - exported, - 0, - function(werr) - assert( - not werr, - lib.lazy_string_concat("Failed to write to file '", filepath, "' for export: ", werr) - ) - end - ) + vim.loop.fs_open(filepath, "w", 438, function(err, fd) + assert(not err, lib.lazy_string_concat("Failed to open file '", filepath, "' for export: ", err)) + assert(fd) - vim.schedule(lib.wrap(utils.notify, "Successfully exported 1 file!")) - end - ) + vim.loop.fs_write(fd, exported, 0, function(werr) + assert(not werr, lib.lazy_string_concat("Failed to write to file '", filepath, "' for export: ", werr)) + end) + + vim.schedule(lib.wrap(utils.notify, "Successfully exported 1 file!")) + end) elseif event.type == "core.neorgcmd.events.export.directory" then local path = event.content[3] and vim.fn.expand(event.content[3]) or module.config.public.export_dir @@ -312,24 +299,19 @@ module.on_event = function(event) ) assert(fd) - vim.loop.fs_write( - fd, - exported, - 0, - function(werr) - assert( - not werr, - lib.lazy_string_concat( - "Failed to write to file '", - write_path, - "' for export: ", - werr - ) + vim.loop.fs_write(fd, exported, 0, function(werr) + assert( + not werr, + lib.lazy_string_concat( + "Failed to write to file '", + write_path, + "' for export: ", + werr ) + ) - check_counters() - end - ) + check_counters() + end) end) end) end diff --git a/lua/neorg/modules/core/keybinds/module.lua b/lua/neorg/modules/core/keybinds/module.lua index b06da6c26..83c10d3f4 100644 --- a/lua/neorg/modules/core/keybinds/module.lua +++ b/lua/neorg/modules/core/keybinds/module.lua @@ -74,12 +74,9 @@ module.load = function() module.required["core.autocommands"].enable_autocommand("BufLeave") if module.config.public.hook then - neorg.callbacks.on_event( - "core.keybinds.events.enable_keybinds", - function(_, keybinds) - module.config.public.hook(keybinds) - end - ) + neorg.callbacks.on_event("core.keybinds.events.enable_keybinds", function(_, keybinds) + module.config.public.hook(keybinds) + end) end end diff --git a/lua/neorg/modules/core/ui/module.lua b/lua/neorg/modules/core/ui/module.lua index 9f4d6ef13..60938c84e 100644 --- a/lua/neorg/modules/core/ui/module.lua +++ b/lua/neorg/modules/core/ui/module.lua @@ -368,8 +368,7 @@ module.examples = { local buffer = module.public.create_split("selection/Test selection") -- Binds a selection to that buffer - local selection = module - .public + local selection = module.public .begin_selection(buffer) :apply({ -- A title will simply be text with a custom highlight diff --git a/lua/neorg/modules/core/upgrade/module.lua b/lua/neorg/modules/core/upgrade/module.lua index fb11779f1..95e1a34a2 100644 --- a/lua/neorg/modules/core/upgrade/module.lua +++ b/lua/neorg/modules/core/upgrade/module.lua @@ -24,7 +24,9 @@ local log, modules = neorg.log, neorg.modules local module = modules.create("core.upgrade") module.setup = function() - log.error("The `core.upgrade` module has been deprecated and is no longer in use. Please remove it from your loaded list.") + log.error( + "The `core.upgrade` module has been deprecated and is no longer in use. Please remove it from your loaded list." + ) return { success = false,