style: run stylua

This commit is contained in:
Thomas Lambert
2022-09-28 22:35:11 +02:00
parent 74636e7416
commit 74ba88dd98
5 changed files with 57 additions and 64 deletions

View File

@@ -433,11 +433,8 @@ function strwalker:match(s)
end end
function strwalker:__call(s, f) -- print("strwalker:__call "..s..self:aimchr()) function strwalker:__call(s, f) -- print("strwalker:__call "..s..self:aimchr())
local is, ie local is, ie
is, ie, self[1], self[2], self[3], self[4], self[5] = find( is, ie, self[1], self[2], self[3], self[4], self[5] =
self.s, find(self.s, s, self.i)
s,
self.i
)
if is then if is then
self.e, self.i = self.i, 1 + ie self.e, self.i = self.i, 1 + ie
if f then if f then
@@ -627,13 +624,13 @@ local function date_parse(str)
end end
-- create date object -- create date object
dn = ( dn = (
y y
and ( and (
(w and makedaynum_isoywd(y, w, u)) (w and makedaynum_isoywd(y, w, u))
or (j and makedaynum(y, 0, j)) or (j and makedaynum(y, 0, j))
or makedaynum(y, m, d) or makedaynum(y, m, d)
) )
) or DAYNUM_DEF ) or DAYNUM_DEF
df = makedayfrc(h or 0, r or 0, s or 0, 0) + ((z or 0) * TICKSPERMIN) df = makedayfrc(h or 0, r or 0, s or 0, 0) + ((z or 0) * TICKSPERMIN)
--print("Zone",h,r,s,z,m,d,y,df) --print("Zone",h,r,s,z,m,d,y,df)
return date_new(dn, df) -- no need to :normalize(); return date_new(dn, df) -- no need to :normalize();

View File

@@ -6,11 +6,11 @@ local date = require("taglinks.date")
--- see https://en.wikipedia.org/wiki/ISO_week_date --- see https://en.wikipedia.org/wiki/ISO_week_date
M.dow_for_year = function(year) M.dow_for_year = function(year)
return ( return (
year year
+ math.floor(year / 4) + math.floor(year / 4)
- math.floor(year / 100) - math.floor(year / 100)
+ math.floor(year / 400) + math.floor(year / 400)
) % 7 ) % 7
end end
M.weeks_in_year = function(year) M.weeks_in_year = function(year)

View File

@@ -97,12 +97,8 @@ M.generate_backlink_map = function(opts)
link_counts[note_fn] = link_counts[note_fn] + 1 link_counts[note_fn] = link_counts[note_fn] + 1
-- and: inc the backlinks of the linked note -- and: inc the backlinks of the linked note
local fexists, backlinked_file = resolve_link( local fexists, backlinked_file =
linktitle, resolve_link(linktitle, file_list, subdir_list, opts)
file_list,
subdir_list,
opts
)
-- print( -- print(
-- "note for link `" -- "note for link `"
-- .. linktitle -- .. linktitle

View File

@@ -146,26 +146,24 @@ M.do_find_all_tags = function(opts)
local cmd, args = command_find_all_tags(opts) local cmd, args = command_find_all_tags(opts)
--print(cmd .. " " .. vim.inspect(args)) --print(cmd .. " " .. vim.inspect(args))
local ret = {} local ret = {}
local _ = Job local _ = Job:new({
:new({ command = cmd,
command = cmd, args = args,
args = args, enable_recording = true,
enable_recording = true, on_exit = function(j, return_val)
on_exit = function(j, return_val) if return_val == 0 then
if return_val == 0 then for _, line in pairs(j:result()) do
for _, line in pairs(j:result()) do parse_entry(opts, line, ret)
parse_entry(opts, line, ret)
end
else
print("rg return value: " .. tostring(return_val))
print("stderr: ", vim.inspect(j:stderr_result()))
end end
end, else
on_stderr = function(err, data, _) print("rg return value: " .. tostring(return_val))
print("error: " .. tostring(err) .. "data: " .. data) print("stderr: ", vim.inspect(j:stderr_result()))
end, end
}) end,
:sync() on_stderr = function(err, data, _)
print("error: " .. tostring(err) .. "data: " .. data)
end,
}):sync()
-- print("final results: " .. vim.inspect(ret)) -- print("final results: " .. vim.inspect(ret))
return ret return ret
end end

View File

@@ -12,29 +12,31 @@ local vaults = function(telekasten, opts)
for k, v in pairs(vaults) do for k, v in pairs(vaults) do
table.insert(_vaults, { k, v }) table.insert(_vaults, { k, v })
end end
pickers.new(opts, { pickers
prompt_title = "Vaults", .new(opts, {
finder = finders.new_table({ prompt_title = "Vaults",
results = _vaults, finder = finders.new_table({
entry_maker = function(entry) results = _vaults,
return { entry_maker = function(entry)
value = entry, return {
display = entry[1], value = entry,
ordinal = entry[1], display = entry[1],
} ordinal = entry[1],
}
end,
}),
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
-- print(vim.inspect(selection))
telekasten.chdir(selection.value[2])
end)
return true
end, end,
}), })
sorter = conf.generic_sorter(opts), :find()
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
-- print(vim.inspect(selection))
telekasten.chdir(selection.value[2])
end)
return true
end,
}):find()
end end
M.vaults = vaults M.vaults = vaults