Tuesday, September 14, 2010

question re: form of function names in vimscript

I thought the rules for naming user functions in Vimscript were (1)
must begin with capital letter unless (2) using s: prefix. But I
noticed that in the code for the pathogen plugin the function names
don't meet either of those requirements. In the pathogen script the
function names all appear as lower case with what appears to be a (1)
local identifier followed by (2) the '#' sign, followed by (3) the
function name. Like this:
----------------------------------------------------------------
Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1
-------------------------------------------------------------

Is this form of function name documented? How does its functionality
differ, if at all, from version where the script scope identifier (s:)
is prefixed to a function name?

-- Herb Sitz

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