Monday, August 31, 2009

Re: expand variable to command line

> How to print an expanded variable into vim command line? For some
> reason I would like to map e.g. F12 to complete edit command with vim
> user files path. I would do something like:
>
> :map <F12> :edit expand($VIM)
>
> What it prints is
>
> :edit expand($VIM)
>
> and I want
>
> :edit /usr/share/vim

Several ways:

:map <f12> :edit <c-r>=expand($VIM)<cr><cr>
:map <f12> :exec "edit ".expand($VIM)<cr>

-tim

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: