I want to set vim file search path to include git repository root (which can be found by git rev-parse --show-toplevel
). I can't figure out how to append the output of this git
command to "set path=.,,**
" in .vimrc.
Thanks!
You can use this command:
let &path .= "," . system("git rev-parse --show-toplevel | tr -d '\\n'")
That said, I usually start Vim from the top-level directory of the project and never change the working directory so that's one less setting to worry about.
See :help system()
and :help :let
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With