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

查看:19
本文介绍了在 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?

解决方案

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天全站免登陆