From 55ef3ddc7b1cd1c8429144ab385cd26d4478e03f Mon Sep 17 00:00:00 2001 From: Sergio Alejandro Vargas Date: Tue, 31 Jan 2023 18:25:12 -0500 Subject: [PATCH] Format --- .stylua.toml | 4 ++-- lua/paq.lua | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.stylua.toml b/.stylua.toml index d54ee8f..8bbcc38 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -1,6 +1,6 @@ -column_width = 120 +column_width = 100 line_endings = "Unix" indent_type = "Spaces" indent_width = 4 quote_style = "ForceDouble" -no_call_parentheses = false +call_parentheses = "NoSingleTable" diff --git a/lua/paq.lua b/lua/paq.lua index 5bf94d3..31c4f98 100644 --- a/lua/paq.lua +++ b/lua/paq.lua @@ -3,15 +3,15 @@ local cfg = { path = vim.fn.stdpath("data") .. "/site/pack/paqs/", opt = false, verbose = false, - url_format = 'https://github.com/%s.git' + url_format = "https://github.com/%s.git", } local logpath = vim.fn.has("nvim-0.8") == 1 and vim.fn.stdpath("log") or vim.fn.stdpath("cache") local logfile = logpath .. "/paq.log" -local packages = {} -- 'name' = {options...} pairs +local packages = {} -- "name" = {options...} pairs -- This is done only once. Doing it for every process seems overkill local env = {} -local envfn = vim.fn.has('nvim-0.6') == 1 and uv.os_environ or vim.fn.environ -- compat +local envfn = vim.fn.has("nvim-0.6") == 1 and uv.os_environ or vim.fn.environ for var, val in pairs(envfn()) do table.insert(env, string.format("%s=%s", var, val)) end @@ -36,7 +36,10 @@ local function report(op, name, res, n, total) hook = { ok = "Ran hook for", err = "Failed to run hook for" }, } local count = n and string.format(" [%d/%d]", n, total) or "" - vim.notify(string.format(" Paq:%s %s %s", count, messages[op][res], name), res == "err" and vim.log.levels.ERROR) + vim.notify( + string.format(" Paq:%s %s %s", count, messages[op][res], name), + res == "err" and vim.log.levels.ERROR + ) end local function new_counter() @@ -49,8 +52,8 @@ local function new_counter() report(over_op or op, name, res, c.ok + c.nop, total) end end - local summary = (" Paq: %s complete. %d ok; %d errors;" .. (c.nop > 0 and " %d no-ops" or "")) - vim.notify(summary:format(op, c.ok, c.err, c.nop)) + local summary = " Paq: %s complete. %d ok; %d errors;" .. (c.nop > 0 and " %d no-ops" or "") + vim.notify(string.format(summary, op, c.ok, c.err, c.nop)) vim.cmd("packloadall! | silent! helptags ALL") vim.cmd("doautocmd User PaqDone" .. op:gsub("^%l", string.upper)) return true @@ -197,7 +200,7 @@ end local function find_unlisted() local unlisted = {} -- TODO(breaking): Replace with `vim.fs.dir` - for _, packdir in pairs({ "start", "opt" }) do + for _, packdir in pairs { "start", "opt" } do local path = cfg.path .. packdir local handle = uv.fs_scandir(path) while handle do @@ -245,7 +248,7 @@ local function list() table.sort(installed, sort_by_name) table.sort(removed, sort_by_name) local markers = { installed = "+", updated = "*" } - for header, pkgs in pairs({ ["Installed packages:"] = installed, ["Recently removed:"] = removed }) do + for header, pkgs in pairs { ["Installed packages:"] = installed, ["Recently removed:"] = removed } do if #pkgs ~= 0 then print(header) for _, pkg in ipairs(pkgs) do