Closed AlphabetsAlphabets closed 1 year ago
To add onto the "it has no effect on function" after using it for a while unsurprisingly, the fuzzy searching also matches the /home/yjh/neorg
part and will occasionally make things difficult when it matches that instead of the actual file name.
imo it makes no sense to try to fix things like this I should just overwrite the select action to make it work
because as far as I understand opening the files is the only issue
because as far as I understand opening the files is the only issue
It's not just opening the files. The preview is completely empty as well. #30
I fixed it locally by creating the picker like this:
pickers
.new(opts, {
prompt_title = opts.prompt_title or "Find Norg Files",
cwd = files[1],
finder = finders.new_table({
results = files[2],
entry_maker = function(entry)
return {
value = entry,
display = entry,
ordinal = entry,
path = files[1] .. neorg.configuration.pathsep .. entry
}
end,
}),
previewer = conf.file_previewer(opts),
sorter = conf.file_sorter(opts),
})
:find()
The get_neorg_files
doesn't need to be modified. It can be reverted their changes.
And even easier:
return function(opts)
opts = opts or {}
local files = get_norg_files()
if not (files and files[2]) then
return
end
pickers
.new(opts, {
prompt_title = opts.prompt_title or "Find Norg Files",
finder = finders.new_table({
results = files[2],
entry_maker = make_entry.gen_from_file({ cwd = files[1] })
}),
previewer = conf.file_previewer(opts),
sorter = conf.file_sorter(opts),
})
:find()
end
It seems that the original code was well defined, but some variables where used in an invalid place.
Your solution works @Nekketsu, I'll update my PR to include your code. Or would you like to submit your own PR? If that's the case, you can close the PR with your next comment.
because as far as I understand opening the files is the only issue
It's not just opening the files. The preview is completely empty as well. #30
there must be a better way of fixing this anyway I can look into it later today
something similar to what @Nekketsu did should work @Nekketsu do you want to open a pr or should I just push a fix?
This is to fix #30. My not be the best solution given that you can use
:Telescope find_norg_files
from anywhere and you'll be able to view your norg files. This works similarly to settingvim.opt.autochdir = true
in an ftplugin or your configsOne minor edit is that it will always show the absolute file path. Of course this has no issue with function. I'm just really hung up on the appearance lmao.