Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the root of git repository to vi/vim find path?

Tags:

git

linux

vim

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!

like image 926
hesham_EE Avatar asked Sep 01 '25 02:09

hesham_EE


1 Answers

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

like image 126
romainl Avatar answered Sep 02 '25 15:09

romainl