madiyaan wrote:
> On Nov 16, 12:26 pm, madiyaan <[EMAIL PROTECTED]> wrote:
>> On Nov 14, 5:16 pm, "Chris Suter" <[EMAIL PROTECTED]> wrote:
>>
>>> you could do a mapping such as the following:
>>> :cmap %/ ^R%^FF/lC
>> Thank you. This would be something very useful. However, it doesn't
>> work in my current vim. When I put in just this:
>>
>>> :cmap %/ ^R%
>> It does place the entire full path of the current file in there. But
>> if I put in the full command that you wrote here, it instead shows me
>> a history of commands (basically the same window when I do q:) instead
>> of leaving me with the path of the current file. Any ideas what could
>> be going wrong? I entered the digraphs correctly as it shows me those
>> in a different color when I wrote them to my .vimrc file.
>>
>> Also, I tried entering F/lC while in normal mode in front of a path in
>> a regular buffer, and it worked. It seems to me that ^F is not doing
>> what it should be doing (i.e. it is not putting me into normal mode on
>> the Ex line). Any help would be appreciated.
>
> OK, I figured this one out:
>
> cmap %/ ^R%^F$F/lC
>
> works as expected, and I thank you for it (there was a missing $). But
> it would be really really useful if it copied this command back to the
> Ex command line and not in a separate Ex buffer. That way I could use
> tab and vim would autocomplete the filename for me.
>
> So once again, thanks a lot, but I would appreciate if you could tell
> me a way to copy this back to the Ex command line (from the Ex history
> buffer).
Quickly, I can't modify that one, but can propose another similar
solution if you want to actually see the path on the commandline:
:cmap %/ <C-r>=expand('%:p:h')<CR>/
(Incidentally, you could write ^R and ^F as <C-r> and <C-f> in your one
above, too, as long as you're not running in compatible mode.)
:help c_CTRL-R_=
:help expand()
Ben.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---