> Right. Here's how I would approach it.
>
> I know that in an ex command, <cfile> is a token that is replaced by
> the name of the file under the cursor, so I would start there.
>
> :help <cfile>
>
> Then I know that the substitute() function will let me delete the
> leading /.
>
> :help substitute()
>
> Finally, I know that the :find command is the ex equivalent of the
> normal-mode gf command.
>
> :help :find
>
> To help put those together into a mapping, there are overviews of
> mapping here:
>
> :help 05.3
> :help 40.1
>
> which I found by going to the table of contents for the user manual,
>
> :help toc
>
> and searching for "map".
>
> A very useful command for executing ex commands with variable
> arguments is :execute:
>
> :help :execute
>
Thank you thank you thank you! This is exactly what I need: to know
_where_ to find the info, without starting "In the beginning"... Thank
you!
> Putting that all together, I came up with this:
>
> nnoremap gf :exe 'find' substitute(expand('<cfile>'), '^/', '', '')<CR>
>
I won't look at that just yet! But I will compare notes after I piece
mine together, or if I get too stuck.
Again, thank you! I will figure this out and post back.
--
Dotan Cohen
http://gibberish.co.il
http://what-is-what.com
--
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
No comments:
Post a Comment