wvanlint / twf

Standalone tree view file explorer, inspired by fzf.
271 stars 11 forks source link

Twf crashes, if the passed path is not a child of the current working directory. #23

Open jmehne opened 2 years ago

jmehne commented 2 years ago

Hello,

thanks for this nice tool. I'm currently trying to use it to replace NERDtree etc. in vim. Unfortunately, twf crashes, when the path passed to it is not a child of the current working directory. This also happens with plain twf without vim:

goroutine 1 [running]: main.main() github.com/wvanlint/twf/cmd/twf/main.go:69 +0x7d0


I find this especially important for the vim use case:

cd /tmp vim /home/foo

in vim, trying to navigate the directory of the opened buffer

! twf /tmp

Results in an error:

panic: Path not found: /home

goroutine 1 [running]: main.main() github.com/wvanlint/twf/cmd/twf/main.go:69 +0x7d0

shell returned 2

Press ENTER or type command to continue

elder-n00b commented 1 year ago

late but... twf -dir /any/other/dir [optional/file/to/focus]

Notes from the README:

It is also possible to locate and highlight a file given as an argument. twf path/to/subdir/file

-dir <dir>: Root directory to browse.