mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
style: run stylua
This commit is contained in:
@@ -433,11 +433,8 @@ function strwalker:match(s)
|
||||
end
|
||||
function strwalker:__call(s, f) -- print("strwalker:__call "..s..self:aimchr())
|
||||
local is, ie
|
||||
is, ie, self[1], self[2], self[3], self[4], self[5] = find(
|
||||
self.s,
|
||||
s,
|
||||
self.i
|
||||
)
|
||||
is, ie, self[1], self[2], self[3], self[4], self[5] =
|
||||
find(self.s, s, self.i)
|
||||
if is then
|
||||
self.e, self.i = self.i, 1 + ie
|
||||
if f then
|
||||
@@ -627,13 +624,13 @@ local function date_parse(str)
|
||||
end
|
||||
-- create date object
|
||||
dn = (
|
||||
y
|
||||
and (
|
||||
(w and makedaynum_isoywd(y, w, u))
|
||||
or (j and makedaynum(y, 0, j))
|
||||
or makedaynum(y, m, d)
|
||||
)
|
||||
) or DAYNUM_DEF
|
||||
y
|
||||
and (
|
||||
(w and makedaynum_isoywd(y, w, u))
|
||||
or (j and makedaynum(y, 0, j))
|
||||
or makedaynum(y, m, d)
|
||||
)
|
||||
) or DAYNUM_DEF
|
||||
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)
|
||||
return date_new(dn, df) -- no need to :normalize();
|
||||
|
||||
@@ -6,11 +6,11 @@ local date = require("taglinks.date")
|
||||
--- see https://en.wikipedia.org/wiki/ISO_week_date
|
||||
M.dow_for_year = function(year)
|
||||
return (
|
||||
year
|
||||
+ math.floor(year / 4)
|
||||
- math.floor(year / 100)
|
||||
+ math.floor(year / 400)
|
||||
) % 7
|
||||
year
|
||||
+ math.floor(year / 4)
|
||||
- math.floor(year / 100)
|
||||
+ math.floor(year / 400)
|
||||
) % 7
|
||||
end
|
||||
|
||||
M.weeks_in_year = function(year)
|
||||
|
||||
@@ -97,12 +97,8 @@ M.generate_backlink_map = function(opts)
|
||||
link_counts[note_fn] = link_counts[note_fn] + 1
|
||||
|
||||
-- and: inc the backlinks of the linked note
|
||||
local fexists, backlinked_file = resolve_link(
|
||||
linktitle,
|
||||
file_list,
|
||||
subdir_list,
|
||||
opts
|
||||
)
|
||||
local fexists, backlinked_file =
|
||||
resolve_link(linktitle, file_list, subdir_list, opts)
|
||||
-- print(
|
||||
-- "note for link `"
|
||||
-- .. linktitle
|
||||
|
||||
@@ -146,26 +146,24 @@ M.do_find_all_tags = function(opts)
|
||||
local cmd, args = command_find_all_tags(opts)
|
||||
--print(cmd .. " " .. vim.inspect(args))
|
||||
local ret = {}
|
||||
local _ = Job
|
||||
:new({
|
||||
command = cmd,
|
||||
args = args,
|
||||
enable_recording = true,
|
||||
on_exit = function(j, return_val)
|
||||
if return_val == 0 then
|
||||
for _, line in pairs(j:result()) do
|
||||
parse_entry(opts, line, ret)
|
||||
end
|
||||
else
|
||||
print("rg return value: " .. tostring(return_val))
|
||||
print("stderr: ", vim.inspect(j:stderr_result()))
|
||||
local _ = Job:new({
|
||||
command = cmd,
|
||||
args = args,
|
||||
enable_recording = true,
|
||||
on_exit = function(j, return_val)
|
||||
if return_val == 0 then
|
||||
for _, line in pairs(j:result()) do
|
||||
parse_entry(opts, line, ret)
|
||||
end
|
||||
end,
|
||||
on_stderr = function(err, data, _)
|
||||
print("error: " .. tostring(err) .. "data: " .. data)
|
||||
end,
|
||||
})
|
||||
:sync()
|
||||
else
|
||||
print("rg return value: " .. tostring(return_val))
|
||||
print("stderr: ", vim.inspect(j:stderr_result()))
|
||||
end
|
||||
end,
|
||||
on_stderr = function(err, data, _)
|
||||
print("error: " .. tostring(err) .. "data: " .. data)
|
||||
end,
|
||||
}):sync()
|
||||
-- print("final results: " .. vim.inspect(ret))
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -12,29 +12,31 @@ local vaults = function(telekasten, opts)
|
||||
for k, v in pairs(vaults) do
|
||||
table.insert(_vaults, { k, v })
|
||||
end
|
||||
pickers.new(opts, {
|
||||
prompt_title = "Vaults",
|
||||
finder = finders.new_table({
|
||||
results = _vaults,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = entry[1],
|
||||
ordinal = entry[1],
|
||||
}
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "Vaults",
|
||||
finder = finders.new_table({
|
||||
results = _vaults,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
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,
|
||||
}),
|
||||
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,
|
||||
}):find()
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
M.vaults = vaults
|
||||
|
||||
Reference in New Issue
Block a user