Loading ...
Sorry, an error occurred while loading the content.

Question about indirection in plugin example

Expand Messages
  • Gary Johnson
    I ve been writing a filetype plugin and trying to follow the guidelines in write-plugin and write-filetype-plugin . I m confused about lines 23 and 27 of
    Message 1 of 1 , Dec 1, 2002
    • 0 Attachment
      I've been writing a filetype plugin and trying to follow the
      guidelines in "write-plugin" and "write-filetype-plugin". I'm
      confused about lines 23 and 27 of the example plugin:

      23 noremap <unique> <script> <Plug>TypecorrAdd <SID>Add
      ..
      27 noremap <SID>Add :call <SID>Add(expand("<cword>"), 1)<CR>

      Is there any reason for the <SID>Add macro other than to allow the
      Add() function to be called from a menu (as is done in line 25)

      25 noremenu <script> Plugin.Add\ Correction <SID>Add

      as well as from the keyboard macro without repeating the full
      function call in both places? If so, and if the function was not
      going to be called from a menu, wouldn't it work as well to replace
      the two mappings of lines 23 and 27 by one?

      noremap <unique> <script> <Plug>TypecorrAdd :call <SID>Add(expand("<cword>"), 1)<CR>

      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Spokane, Washington, USA
    Your message has been successfully submitted and would be delivered to recipients shortly.