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:
@@ -756,8 +756,7 @@ function Pinfo:resolve_path(p, opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- now work out subdir relative to root
|
-- now work out subdir relative to root
|
||||||
self.sub_dir = p
|
self.sub_dir = p:gsub(escape(self.root_dir .. "/"), "")
|
||||||
:gsub(escape(self.root_dir .. "/"), "")
|
|
||||||
:gsub(escape(self.filename), "")
|
:gsub(escape(self.filename), "")
|
||||||
:gsub("/$", "")
|
:gsub("/$", "")
|
||||||
:gsub("^/", "")
|
:gsub("^/", "")
|
||||||
@@ -873,9 +872,7 @@ function Pinfo:resolve_link(title, opts)
|
|||||||
if opts.new_note_location == "smart" then
|
if opts.new_note_location == "smart" then
|
||||||
self.filepath = opts.home .. "/" .. self.filename -- default
|
self.filepath = opts.home .. "/" .. self.filename -- default
|
||||||
self.is_daily, self.is_weekly, self.calendar_info =
|
self.is_daily, self.is_weekly, self.calendar_info =
|
||||||
check_if_daily_or_weekly(
|
check_if_daily_or_weekly(self.title)
|
||||||
self.title
|
|
||||||
)
|
|
||||||
if self.is_daily == true then
|
if self.is_daily == true then
|
||||||
self.root_dir = opts.dailies
|
self.root_dir = opts.dailies
|
||||||
self.filepath = opts.dailies .. "/" .. self.filename
|
self.filepath = opts.dailies .. "/" .. self.filename
|
||||||
@@ -997,10 +994,12 @@ local media_preview = defaulter(function(opts)
|
|||||||
return conf.file_previewer(opts)
|
return conf.file_previewer(opts)
|
||||||
end
|
end
|
||||||
return previewers.new_termopen_previewer({
|
return previewers.new_termopen_previewer({
|
||||||
get_command = opts.get_command or function(entry)
|
get_command = opts.get_command
|
||||||
|
or function(entry)
|
||||||
local tmp_table = vim.split(entry.value, "\t")
|
local tmp_table = vim.split(entry.value, "\t")
|
||||||
local preview = opts.get_preview_window()
|
local preview = opts.get_preview_window()
|
||||||
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd()
|
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd)
|
||||||
|
or vim.loop.cwd()
|
||||||
if vim.tbl_isempty(tmp_table) then
|
if vim.tbl_isempty(tmp_table) then
|
||||||
return { "echo", "" }
|
return { "echo", "" }
|
||||||
end
|
end
|
||||||
@@ -1064,11 +1063,8 @@ local function find_files_sorted(opts)
|
|||||||
local hl_group
|
local hl_group
|
||||||
local display = utils.transform_path(display_opts, display_entry.value)
|
local display = utils.transform_path(display_opts, display_entry.value)
|
||||||
|
|
||||||
display, hl_group = utils.transform_devicons(
|
display, hl_group =
|
||||||
display_entry.value,
|
utils.transform_devicons(display_entry.value, display, false)
|
||||||
display,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
if hl_group then
|
if hl_group then
|
||||||
return display, { { { 1, 3 }, hl_group } }
|
return display, { { { 1, 3 }, hl_group } }
|
||||||
@@ -2277,17 +2273,12 @@ local function FollowLink(opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
local hl_group
|
local hl_group
|
||||||
local display = utils.transform_path(
|
local display =
|
||||||
display_opts,
|
utils.transform_path(display_opts, display_entry.value)
|
||||||
display_entry.value
|
|
||||||
)
|
|
||||||
|
|
||||||
display_entry.filn = display_entry.filn or display:gsub(":.*", "")
|
display_entry.filn = display_entry.filn or display:gsub(":.*", "")
|
||||||
display, hl_group = utils.transform_devicons(
|
display, hl_group =
|
||||||
display_entry.filn,
|
utils.transform_devicons(display_entry.filn, display, false)
|
||||||
display,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
if hl_group then
|
if hl_group then
|
||||||
return display, { { { 1, 3 }, hl_group } }
|
return display, { { { 1, 3 }, hl_group } }
|
||||||
@@ -2368,10 +2359,8 @@ local function FollowLink(opts)
|
|||||||
local find = (function()
|
local find = (function()
|
||||||
if Path.path.sep == "\\" then
|
if Path.path.sep == "\\" then
|
||||||
return function(t)
|
return function(t)
|
||||||
local start, _, filn, lnum, col, text = string.find(
|
local start, _, filn, lnum, col, text =
|
||||||
t,
|
string.find(t, [[([^:]+):(%d+):(%d+):(.*)]])
|
||||||
[[([^:]+):(%d+):(%d+):(.*)]]
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Handle Windows drive letter (e.g. "C:") at the beginning (if present)
|
-- Handle Windows drive letter (e.g. "C:") at the beginning (if present)
|
||||||
if start == 3 then
|
if start == 3 then
|
||||||
@@ -2382,10 +2371,8 @@ local function FollowLink(opts)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
return function(t)
|
return function(t)
|
||||||
local _, _, filn, lnum, col, text = string.find(
|
local _, _, filn, lnum, col, text =
|
||||||
t,
|
string.find(t, [[([^:]+):(%d+):(%d+):(.*)]])
|
||||||
[[([^:]+):(%d+):(%d+):(.*)]]
|
|
||||||
)
|
|
||||||
return filn, lnum, col, text
|
return filn, lnum, col, text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2792,7 +2779,8 @@ local function FindAllTags(opts)
|
|||||||
opts.cwd = M.Cfg.home
|
opts.cwd = M.Cfg.home
|
||||||
opts.tag_notation = M.Cfg.tag_notation
|
opts.tag_notation = M.Cfg.tag_notation
|
||||||
opts.i = i
|
opts.i = i
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Tags",
|
prompt_title = "Tags",
|
||||||
finder = finders.new_table({
|
finder = finders.new_table({
|
||||||
results = taglist,
|
results = taglist,
|
||||||
@@ -2813,7 +2801,8 @@ local function FindAllTags(opts)
|
|||||||
attach_mappings = function(prompt_bufnr, map)
|
attach_mappings = function(prompt_bufnr, map)
|
||||||
actions.select_default:replace(function()
|
actions.select_default:replace(function()
|
||||||
-- actions for insert tag, default action: search for tag
|
-- actions for insert tag, default action: search for tag
|
||||||
local selection = action_state.get_selected_entry().value.tag
|
local selection =
|
||||||
|
action_state.get_selected_entry().value.tag
|
||||||
local follow_opts = {
|
local follow_opts = {
|
||||||
follow_tag = selection,
|
follow_tag = selection,
|
||||||
show_link_counts = true,
|
show_link_counts = true,
|
||||||
@@ -2832,7 +2821,8 @@ local function FindAllTags(opts)
|
|||||||
map("n", "<esc>", picker_actions.close(opts))
|
map("n", "<esc>", picker_actions.close(opts))
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Setup(cfg)
|
-- Setup(cfg)
|
||||||
@@ -3043,7 +3033,8 @@ local TelekastenCmd = {
|
|||||||
TelekastenCmd.command = function(subcommand)
|
TelekastenCmd.command = function(subcommand)
|
||||||
local show = function(opts)
|
local show = function(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Command palette",
|
prompt_title = "Command palette",
|
||||||
finder = finders.new_table({
|
finder = finders.new_table({
|
||||||
results = TelekastenCmd.commands(),
|
results = TelekastenCmd.commands(),
|
||||||
@@ -3063,12 +3054,14 @@ TelekastenCmd.command = function(subcommand)
|
|||||||
-- apparently it has sth to do with keeping insert mode
|
-- apparently it has sth to do with keeping insert mode
|
||||||
actions._close(prompt_bufnr, true)
|
actions._close(prompt_bufnr, true)
|
||||||
|
|
||||||
local selection = action_state.get_selected_entry().value[3]
|
local selection =
|
||||||
|
action_state.get_selected_entry().value[3]
|
||||||
selection()
|
selection()
|
||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
if subcommand then
|
if subcommand then
|
||||||
-- print("trying subcommand " .. "`" .. subcommand .. "`")
|
-- print("trying subcommand " .. "`" .. subcommand .. "`")
|
||||||
|
|||||||
Reference in New Issue
Block a user