andreyorst / fzf.kak

FZF for Kakoune
MIT License
143 stars 33 forks source link

Fix the open files in directory of current file feature #100

Closed sidkshatriya closed 2 years ago

sidkshatriya commented 2 years ago

Sorry for revisiting this feature again with another PR! In my excitement to get this merged, I actually did not test the feature fully. I was just looking at the candidate results in fzf (which were correct) and forgot to actually press enter on them to see if the file actually loaded in kakoune. (In an older cruder implementation it was fully working so I wrongly assume everything was going to be fine...)

TL;DR with this PR everything should work properly now. If you are able to quickly test this as a sanity check, I will greatly appreciate it.


Since we cd-ed into search dir in $cmd, prefix the $search_dir path after fzf returns the results by using -filter switch of fzf. Kakoune either needs an absolute path or path relative to its pwd to edit a file. Since the pwd of $cmd and kakoune now differ, we cannot use a relative path, so we construct the absolute path by prefixing the $search_dir to the file outputted by fzf.

andreyorst commented 2 years ago

I was just looking at the candidate results in fzf (which were correct) and forgot to actually press enter on them to see if the file actually loaded in kakoune.

That's exactly what I did as well :D

TL;DR with this PR everything should work properly now. If you are able to quickly test this as a sanity check, I will greatly appreciate it.

Will do!