On Thu, Oct 1, 2009 at 4:03 PM, Andy Wokula <anw...@yahoo.de> wrote: > > Hari Krishna Dara schrieb: >> On Wed, Sep 30, 2009 at 2:27 AM, Andy Wokula <anw...@yahoo.de> wrote: >>> Hari Krishna Dara schrieb: >>>> On Tue, Sep 29, 2009 at 5:35 PM, Kana Natsuno <k...@whileimautomaton.net> >>>> wrote: >>> At least >>> :map <SNR> >>> >>> prints all my <SID> mappings, which include the script numbers, and I >>> can do e.g. >>> >>> :nn <SNR>15_yank :call <SNR>15_yank()<CR> >>> >>> at the command line to re-execute what was previously defined by a >>> script as: >>> >>> :nn <SID>yank :call <SID>yank()<CR> >> >> This is not a "feature" per se, you are simply finding all those maps >> that have an <SID> in the front. > > Not only an <SID> (<SNR> actually), but also the script-ID. > >> This is not the case that we are trying to point out. Consider these >> two samples: >> >> :nmap <script> <F12> <Plug>SomeScriptLocal >> :inoremap <expr> <Tab> <SID>expandTab()<CR> > > (sorry these examples hurt the eyes ...) > > I'm pretty much aware of that ... you pointed out several things and I > was only referring to the following paragraph: > >>>> If we can extend the :map command to accept an optional scriptID as >>>> <script:SID>, then we could output map commands with the original SID >>>> in place, but then there are two issues: > > Again: This functionality is already there (?). > >> Are you referring to the <script:SID> format already being there? > > Yes, I did. > >> I just checked, it is not there. > > Ah, you want to add a new map-modifier <script:SID> next to <script>, > <expr>, etc? And with SID replaced by the script number? For example > > :nn <script:15> <SID>yank :call <SID>yank()<CR><SID>DoMore > > (Please correct this as needed) > > But how is this different from > > :nn <script> <SNR>15_yank :call <SNR>15_yank()<CR><SNR>15_DoMore > >> You could of course call script local functions using the <SNR>_ >> syntax, but it doesn't serve all cases. > > Ok. > Which are those cases? > Which are those cases solved by your suggestion?
Your suggestion to use <SNR> syntax only serves the cases which involve calling script local functions, but <script> serves a different case than that, see ":help <script>". Also, there is no workaround suggested towards capturing maps with <expr> option yet on this thread. I am sure we can come up with ways to cover these missing cases by enhancing existing commands, but I think the :dupmap command that I am suggestion is the most straight-forward and complete way to capture an existing map (as it literally copies the map at the lowest level). -- Hari > >> I went ahead and did a POC for this feature and am attaching the >> patch. > > Looks promising, but I'll have to let others comment on that. > > -- > Andy > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---