开发者

Open a file from selected text in Vim

For example, if I have something like this:

开发者_如何学Go#include "filename.h"

When I select filename.h I want to use it as the input for opening the file named filename.h in a split.


I believe you want a Ctrl+w, Ctrl+f. Press these keys with the cursor over the filename.


Place your cursor on the file name and press gf in normal mode.

:help gf

You might want to tweak the 'path' option for a list of directories where the file can be found.

:help 'path'


If you want this in a vertical split, and as a command, you can run :vertical wincmd f with your cursor over the word.

You can shorten this to :vert winc f or even nnoremap gf :vert winc f<cr> if you so choose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜