On 07/01/13 10:32, Boris Danilov wrote:
P.S.
Okay, in documentation I found the following way to get the SID number:

function s:SID()
   return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')

I don't understand the SID$ at the end

endfun

So that I can probably use something like
let b:undo_ftplugin = "call <SNR>" . s:SID . "_Func()"
---------------------------------------^^^^^ s:SID() with parens

Is there a simpler way without all these workarounds?

Getting the "current script number" is feasible but not easy. If this works for you after testing, stay with it.


- Boris

On Mon, Jan 7, 2013 at 1:24 PM, Boris Danilov <[email protected]> wrote:
Hello!

The question is how to call a function on a ftplugin undo? As far as I
understand, the universal method for undoing stuff is putting commands
to b:undo_ftplugin, but  I can't put either "s:Fun" or "<SID>Fun"
there.

"s:Fun" doesn't work because b:undo_ftplugin is executed in the other
script file and "<SID>Fun" doesn't work because <SID> isn't expanded
in strings but expanded in the other place where b:undo_ftplugin is
being executed with :execute. Is there a function that will expand
<SID> immediatelly and convert it to a string?

Of course there is always a way to use :autocmd FileType to handle it
manually, but then it makes me wonder why there is a mechanism of
b:undo_ftplugin if I have to do it on my own.

What I am missing there?

- Boris


Best regards,
Tony.
--
The cow is nothing but a machine with makes grass fit for us people to
eat.
                -- John McNulty

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

Reply via email to