如何将QuickFix打开的文件路径归一化?

发布于 2025-02-11 19:53:30 字数 681 浏览 1 评论 0 原文

我使用的是neovim v0.7.2(也通过v0.6.1进行了测试)在git-bash中的Windows 10上使用,允许异步构建(用clang构建C ++代码库)。

当构建中存在错误时,QuickFix会正确填充,但是可能无法将文件路径归一化(例如 src \ lib \ .. \ lib \ header.h )。

header.h 已经通过nerdtree在另一个Neovim窗口中打开时,窗口名称使用归一化名称 src \ lib \ lib \ header.h

然后,如果我尝试从QuickFix中的错误跳跃,Neovim试图在另一个名称不同的窗口中打开同一文件( non normanized路径)。

这引起了许多问题,尤其是因为该文件的交换文件已经存在。如果存在,我想将其跳到文件上已经打开的窗口,或者如果不存在,则将其打开。

可以实现吗?


我已经在 init.vim 中有此选项:

set switchbuf=useopen,usetab,newtab

I am using NeoVim v0.7.2 (also tested with v0.6.1) on Windows 10 in git-bash, with vim-dispatch to allow for asynchronous builds (building a C++ codebase with Clang).

When there are errors in the build, the quickfix is correctly populated, but the file paths might not be normalized (e.g. src\lib\..\lib\Header.h).

When Header.h is already opened in another NeoVim window via NerdTree, the window names uses the normalized name src\lib\Header.h.

Then, if I try to jump from the error in the quickfix, NeoVim attempts to open the same file in another window with a different name (the non normalized path).

This causes a host of issues, notably because the swap file for this file is already present. I would like to have it jump to the already opened window on the file if it exists, or to open it with the normalized name if it does not.

Can it be achieved?


I already have this option in my init.vim:

set switchbuf=useopen,usetab,newtab

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文