gpt4 book ai didi

vim - 在vim中轻松打开包含文件名?

转载 作者:行者123 更新时间:2023-12-02 11:44:56 26 4
gpt4 key购买 nike

基本上,我正在编辑包含文件名的文件,并且我想要一种快速打开文件的方法,而无需键入路径/文件名:

include('inc/doctype.inc.php');

有没有简单的方法可以做到这一点? (理想情况下,我想使用 :tabnew 在新选项卡中打开文件。)

谢谢。

最佳答案

使用gf快捷键。将光标移动到路径字符串上,确切的光标位置并不重要,然后在正常模式下按 gfgf 代表“goto file”。
使用 :h gf 查看 vims 帮助页面:

Uses the 'isfname' option to find out which characters are supposed to be in a file name. Trailing punctuation characters ".,:;!" are ignored. Uses the 'path' option as a list of directory names to look for the file. Also looks for the file relative to the current file. Uses the 'suffixesadd' option to check for file names with a suffix added. If the file can't be found, 'includeexpr' is used to modify the name and another attempt is done.

要返回,请在正常模式下使用 Ctrl-o
注意:此命令将光标位置带到跳转列表中较旧的位置。相反的命令是Ctrl-i,它将光标带到跳转列表中的新位置。

关于vim - 在vim中轻松打开包含文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/916409/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com