如何在新选项卡中制作 Vim 快速修复列表启动文件?

编程入门 行业动态 更新时间:2024-10-28 10:35:39
本文介绍了如何在新选项卡中制作 Vim 快速修复列表启动文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

比如说,我有以下映射:

Say, I have the following mapping:

map <F4> :execute "vimgrep /" .expand("<cword>") . "/j **" <Bar> cw<CR>

它(递归地)为光标下的单词实例搜索当前目录,并在快速修复列表窗口中打开这些文件.

which (recursively) greps the current directory for instances of the word under the cursor and opens these files in the quickfix list window.

如何从 quickfix 窗口启动我打开的文件到新选项卡?Enter 只是将窗口中的当前缓冲区更改为该新文件.

From the quickfix window, how do I launch the file that I open into a new tab? Enter just changes my current buffer in the window to that new file.

推荐答案

Quickfix-window 命令在创建时尊重 switchbuf 选项缓冲区.switchbuf 选项具有 newtab 说明符指示 Vim 在加载缓冲区之前打开一个新的标签页切换到.如果通过

Quickfix-window commands respect the switchbuf option when creating the buffer. The switchbuf option has the newtab specifier that instructs Vim to open a new tab page before loading the buffer to switch to. If one adds this key to the option via

:set switchbuf+=newtab

quickfix 窗口中的条目将在单独的选项卡中打开页.

the entries in the quickfix window will be opened in separate tab pages.

usetab 说明符在这方面也可能有用案件.它规定 Vim 切换到现有的标签页,如果它包含一个显示目标缓冲区的窗口,而不是复制它在一个新标签中.

There is the usetab specifier that also might be useful in this case. It prescribes Vim to switch to an existing tab page if it contains a window displaying the target buffer, instead of duplicating it in a new tab.

:set switchbuf+=usetab,newtab

switchbuf 的值也(部分)影响其他缓冲区切换命令,例如:bfirst:blast:sbuffer:sbnext:sbprevious.

The value of switchbuf also (partially) affects other buffer-switching commands, such as :bfirst, :blast, :sbuffer, :sbnext, and :sbprevious.

这篇关于如何在新选项卡中制作 Vim 快速修复列表启动文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 10:59:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1408902.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   快速   文件   如何在   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!