I am working on a plugin that could potentially define more than 120 different signs
. The vim / neovim documentation specifies that you can define about 120 signs (not sure why this number and why so ambigous). From :he sign-define
:sign define {name} {argument}...
Define a new sign or set attributes for an existing sign.
The {name} can either be a number (all digits) or a name
starting with a non-digit. Leading zeros are ignored, thus
"0012", "012" and "12" are considered the same name.
About 120 different signs can be defined.
The thing is I have already tried to define well over 500 signs and place them as well and I did not see any issues on my system in both vim and neovim. I was wondering if there are any dangers in doing this, or any performance issues.
If anyone is curios how to add so many signs:
" permutations of 2 with repetition
function! Permutations(lst, counter, res)
if a:counter == len(a:lst)
return a:res
endif
let l:res = copy(a:res) + map(copy(a:lst),
\ { idx, val -> a:lst[a:counter] . val })
let l:counter = a:counter + 1
return Permutations(a:lst, l:counter, l:res)
endfunction
" ['aa', 'ab', 'ac', ..., 'zy', 'zz']
function! DefineSigns()
let l:signs = Permutations(
\ map(range(97, 97 + 25), 'nr2char(v:val)'), 0, [])
for i in l:signs
call sign_define(
\ 'signs' . i,
\ {'text': len(i) == 1 ? ' ' . i : i, 'texthl': 'MoreMsg'})
endfor
endfunction
:call DefineSigns() | echo len(sign_getdefined())
676