Re: surround.vim in AsNeeded

2007-02-21 Thread Charles E Campbell Jr

Bill McCarthy wrote:


BTW, as an enhancement request, could AN be enhanced to look
for leadermap when it fails to find charmap?  That is,
if I want to load the align maps:

   AN \abox

doesn't work.  I would need to type:

   AN leaderabox

 


If you happen to have (as an example)

 let mapleader= ;

in your .vimrc, did you know that

 :AN ;abox

would load AlignMaps.vim?  So you don't actually need to type leader,
just the leader you're actually currently using.

Regards,
Chip Campbell



Re: surround.vim in AsNeeded

2007-02-21 Thread Bill McCarthy
On Wed 21-Feb-07 1:56pm -0600, Charles E Campbell Jr wrote:

 Bill McCarthy wrote:

BTW, as an enhancement request, could AN be enhanced to look
for leadermap when it fails to find charmap?  That is,
if I want to load the align maps:

AN \abox

doesn't work.  I would need to type:

AN leaderabox

  

 If you happen to have (as an example)

   let mapleader= ;

 in your .vimrc, did you know that

   :AN ;abox

 would load AlignMaps.vim?  So you don't actually need to type leader,
 just the leader you're actually currently using.

Yes, I understand that if the user has explicitly defined
g:mapleader in their vimrc, then that works.  However, if
the user lets Vim default to '\' then it doesn't work the
way your code is written.

One can certainly add to their vimrc:

  let g:mapleader = '\'

and now:

  :AN \abox

works - which it doesn't now as I mentioned above.

But that won't work when running with -u NORC.

Your fix notes specify:

  v3 May 19, 2004 : * bugfix: now works correctly when mapleader
  wasn't set by user explicitly

so perhaps you fixed this in the past and something is
preventing your fix from working today.

You could easily make default behavior work by adding, right
after your check for previous load, code such as:

  if !exists(g:mapleader)
let g:mapleader = '\'
  endif

Which would allow users who use Vim's default behavior,
without explicitly setting mapleader, to do:

  :AN \abox

-- 
Best regards,
Bill



Re: surround.vim in AsNeeded

2007-02-19 Thread drchip
Quoting Bill McCarthy [EMAIL PROTECTED]:

 Hello Vim List,

 I just tried out surround.vim, recently updated on Vim
 Online.  Nice plugin!

 It works fine when placed in my plugin directory but doesn't
 work if moved to my AsNeeded directory and :MkAsNeeded is
 run.

 Has anyone out there been able to get this to work?

I just tried surround.vim with v15g of AsNeeded (available from my website,
http://mysite.verizon.net/astronaut/vim/index.html#ASNEEDED).  No problems
noted.

I think I should point out that AsNeeded provides transparent support for plugin
loading for commands and functions -- ie. issue a command, and if the
associated plugin hasn't been loaded yet, it will be, and the command is then
executed or the function executed.

However, the surround.vim plugin is largely providing maps.  AsNeeded supports
maps; but not transparently.  For surround.vim, for example:

  :AN cs

will load the surround.vim plugin and make the cs map available.  The reason
why AsNeeded doesn't support transparent map use: consider what would happen
if there are several plugins with maps:  \a  \ab \abc .  If AsNeeded set up
special maps for these, then the infamous
pause-while-waiting-to-see-if-you're-going-to-type-more would appear.  Given
those three maps, assume you wanted \ab in plugin ab.vim.  There'd be a delay
after you typed \ab (because AsNeeded would have had to set up a map for \abc,
and so vim would be waiting a bit to see if you were about to continue to type
that c.  You'd continue to get those pauses every time you wanted to use the
\ab map, too.

Regards,
Chip Campbell




Re: surround.vim in AsNeeded

2007-02-19 Thread Bill McCarthy
On Mon 19-Feb-07 11:13am -0600, [EMAIL PROTECTED] wrote:

 I think I should point out that AsNeeded provides
 transparent support for plugin loading for commands and
 functions -- ie. issue a command, and if the associated
 plugin hasn't been loaded yet, it will be, and the command
 is then executed or the function executed.

 However, the surround.vim plugin is largely providing
 maps.  AsNeeded supports maps; but not transparently.  For
 surround.vim, for example:

   :AN cs

 will load the surround.vim plugin and make the cs map
 available.

AsNeeded does a great job of supporting mapping as long as
the maps are predefined or loaded in my vimrc and map to
commands know by AsNeeded.

As you've pointed out, this is not the case with the
surround.vim plugin.  I've gotten around this problem by
bypassing AsNeeded and splitting the plugin into two
components: just the maps in plugin\surroundPlugin.vim, and
all the functions in autoload\surround.vim.

This was very easy to do and accomplishes the goal of not
loaded all the functions until one is needed.

BTW, as an enhancement request, could AN be enhanced to look
for leadermap when it fails to find charmap?  That is,
if I want to load the align maps:

AN \abox

doesn't work.  I would need to type:

AN leaderabox

-- 
Best regards,
Bill




surround.vim in AsNeeded

2007-02-16 Thread Bill McCarthy
Hello Vim List,

I just tried out surround.vim, recently updated on Vim
Online.  Nice plugin!

It works fine when placed in my plugin directory but doesn't
work if moved to my AsNeeded directory and :MkAsNeeded is
run.

Has anyone out there been able to get this to work?

-- 
Best regards,
Bill