On Wed, 29 Jul 2009, Daniel Tripp wrote:

> From: Daniel Tripp <[email protected]>
>
> Say that I have set a variable like this:
> :let desiredcolumn=42
> And now I want to define a mapping that will go to that column on the current
> line, using the <bar> command.  My problem is that I can't figure out how to
> substitute the variable's value into the 'count' argument of the <bar> 
> command.
> ...
> But instead of a constant like 42, I want to take the value from my
> 'desiredcolumn' variable.  Something like this:
> :map <F2> desiredcolumn<bar>
> But of course that doesn't work.
> Any suggestions?


one possibility:

let g:desiredcolumn = 42
let @m = g:desiredcolumn
map ]2 @m<bar>

or just use the register and bypass the interim variable assignment.

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

Reply via email to