Closed einthusan closed 3 years ago
Found the problem. Can you please do this fix yourself because I have some uncommitted changes in my branch.
All you need to do is replace your old _previewInPopup
function in filerExpl.py
with the one found from Leaderf
in their source code. I have copy/pasted it below for your reference.
Edit: one more thing, you need to check its not a directory before doing the preview!
def _previewInPopup(self, *args, **kwargs):
line = args[0]
if lfEval("bufloaded('%s')" % escQuote(line)) == '1':
source = int(lfEval("bufadd('%s')" % escQuote(line)))
else:
source = line
self._createPopupPreview(line, source, 0)
Turns out the preview break once you change directory in my previous example. Below I now have a version that does not break even when you change directories. Also account for not showing preview for folders.
def _previewInPopup(self, *args, **kwargs):
if len(args) == 0:
return
line = args[0]
# do not show preview for directories
if line[-1] == "/":
return
file = line
if not os.path.isabs(file):
file = os.path.join(self._getInstance().getCwd(), lfDecode(file))
file = os.path.normpath(lfEncode(file))
if lfEval("bufloaded('%s')" % escQuote(file)) == '1':
source = int(lfEval("bufadd('%s')" % escQuote(file)))
else:
source = file
self._createPopupPreview(file, source, 0)
fixed.
Vim8 on MacOS - when trying to get preview to open, an error occurs. Actually, regardless of popup mode or not, it simply wont open. Does it work for you?
still not sure why... will try and look into it but would be great if you can help. thanks.