On Nov 14, 6:47 pm, Dun Peal <[email protected]> wrote:
> Hi there,
>
> I'd like to setup a keyboard shortcut that would work similar to `gf`,
> except it will regard the entire cursor line as the filename to open.
>

Map something to Vgf and you've got it. Or maybe 0v$gf (I'm not 100%
certain line-wise visual acts correctly with gf, but I expect it
does).

> So for example, if I'm on a line that contains the text "foo bar
> baz.", and hit the shortcut, the file "foo bar baz." - a new one if it
> doesn't already exist - will be :edit'ed.
>

gf doesn't do that. There are some suggestions for using :e with the
file name, but this will not search your 'path' option as gf does.

> What's the best way to implement that?
>

Probably you could use :find in place of :e, catch error 345 for when
the file was not found, and use :e as a fallback.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to