如何将git仓库的根目录设置为vi/vim查找路径? [英] How to set the root of git repository to vi/vim find path?
本文介绍了如何将git仓库的根目录设置为vi/vim查找路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设置vim文件搜索路径以包含git仓库根目录(可以通过 git rev-parse --show-toplevel
找到).我不知道如何将此 git
命令的输出附加到.vimrc中的" set path =.,, **
".
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.
谢谢!
推荐答案
您可以使用以下命令:
let &path .= "," . system("git rev-parse --show-toplevel | tr -d '\\n'")
也就是说,我通常从项目的顶层目录启动Vim,并且从不更改工作目录,因此这是少担心的设置.
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.
请参见:help system()
和:help:let
这篇关于如何将git仓库的根目录设置为vi/vim查找路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文