从Vim中的光标下的完整路径打开文件 [英] Open file from complete path under cursor in Vim

查看:370
本文介绍了从Vim中的光标下的完整路径打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个文件包含文件的完整路径,是否有一种方法来突出显示文件名(使用可视模式)并打开文件(最好在分割屏幕中)?

If I have a file that contains a complete path for a file, is there a way to highlight the filename (using visual mode) and open the file (preferably in a split screen)?

这里是我想要的行为:如果文件名包含 / 字符,假设它是一个完整路径)。否则,使用当前文件夹(即默认行为)。这是可能的吗?

Here is the behavior I would like: if the file name contains a / character, assume it is a full path (i.e. the current directory is root). Otherwise, use the current folder (i.e. default behavior). Is this possible?

推荐答案

将光标放在文件名上并键入 gf (在命令模式下)。或使用 CTRL + W | CTRL + F 在另一个窗口中打开。另见:help gf (不,它不是你的女朋友)。

Put the cursor on the filename and type gf (in command mode). Or use CTRL+W | CTRL+F to open in another window. See also :help gf (no, it's not your girlfriend).

这篇关于从Vim中的光标下的完整路径打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆