aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/denote-fzf-lua.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lua/denote-fzf-lua.lua b/lua/denote-fzf-lua.lua
index d685ef9..094f280 100644
--- a/lua/denote-fzf-lua.lua
+++ b/lua/denote-fzf-lua.lua
@@ -76,7 +76,7 @@ end
---@param delim string delimiter character
---Puts a field from the search results back into Denote format (e.g. two words to --two-words)
function M.repopulate_field(f, delim)
- if f == "." then
+ if f == "." then
return ""
else
return delim .. delim .. f:gsub("%s",delim)
@@ -85,6 +85,7 @@ end
---@param filename string chopped up string with fields separated by multiple spaces
function M.recombine_filename(filename)
+ if filename == nil then return "" end
local t = {}
filename = filename:gsub("%s%s+", "|")
t.path, t.year, t.month, t.day, t.hour, t.min, t.sec, t.sig, t.title, t.keywords, t.ext =
@@ -98,7 +99,7 @@ end
---@param options table of user options
---Opens a window to search filenames
function M.search_files(options)
- script_path = M.set_script_path(options.force_slow_mode)
+ local script_path = M.set_script_path(options.force_slow_mode)
if not script_path then return end
local opts = {}
opts.previewer = M.recombine_previewer
@@ -106,9 +107,8 @@ function M.search_files(options)
opts.fzf_opts["--with-nth"] = M.format_fzf_with_nth(options)
opts.fzf_opts['--header-lines'] = 1
opts.fzf_opts['--delimiter'] = "\\s{2,}"
- -- print(vim.inspect(opts))
opts.actions = {
- ['default'] = function(selected, opts)
+ ['default'] = function(selected)
local filename = M.recombine_filename(selected[1])
vim.api.nvim_command('edit ' .. filename)
end }