Wednesday, April 27, 2011

Re: Where is defined?

On Wednesday 27 April 2011 15:14:08 ZyX wrote:
> Reply to message «Re: Where is <localleader> defined?»,
> sent 22:54:22 27 April 2011, Wednesday
>
> by Steve Litt:
> > I'm not sure if I understand what you're writing, but it sounds like what
> > you're doing is, instead of creating <voleader> to be used in a map
> > command, at mapping time you're running a different syntax. Is that
> > correct?
>
> Different syntax? It is just another form of `eval', you can even set
> g:voleader to "<localleader>" to keep old behavior untouched by default.
>
> > If it is, it's not going to work in our application because there are
> > tons of map commands that need to be changed. It's one thing to globally
> > change <localleader> to <voleader>, but it's a little more troublesome
> > (and requires considerable testing) to put in the execute and the g: and
> > the dot.
>
> I do not see any problems here (considering that <localleader> is used only
> inside mapping commands, you are not using :execute to define them and each
> command that defines a mapping takes exactly one line which is not shared
> with
>
> any other command that is not a part of the mapping):
> :%s/\v(\s*)(.{-})\<localleader\>(.*)/\=submatch(1).'execute
>
> '.string(submatch(2)).'.g:voleader.'.string(submatch(3))/
>
> > Can you think of another way to create a <voleader> right at the
> > beginning?
>
> I already said: it is not possible without patching vim. I personally just
> define mappings only using function provided by my own framework which
> cares of using some global variable as the leader and also enables user to
> override any {lhs} using global and/or buffer-local variable (unless it is
> requested to be unoverridable for some reason).

With that in mind, I'm going to plan B, in which we do the following:

map <buffer> <special> .. <F12>

This has been tested and works.

And then just everywhere substitute <F12> for <localleader>. Not as readable,
but it gets the job done. A conflict with Debian customs prevents us from
using the <localleader> variable. Obviously we'll pick a more arcane arcane
and less useful key than <F12> -- this was just a proof of concept.

Thanks for the info -- I would have been chasing a way to define <voleader>
all day if you hadn't clued me in.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt

--
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: