python global function error
I have the following global function
global !p
def label(text):
mydict = {"á" : "a",
for k, v in mydict.items():
text = text.replace(k, v)
label = text.lower(
if len(label) >=10:
return '_'.join(
else:
return '_'.join(label)
endglobal
That I'm using with the following tex snippet:
snippet sec "Section" b
\section{
\label{sec:${2:`!p snip.rv = label(t[1])`}}
${VISUAL}$0
endsnippet
The python code runs fine when I try it in my system (using python 2.7) but when I use it as a snippet it gives a series of errors. In particular something like
Error detected while processing function UltiSnips_
vim.
Error detected while processing function UltiSnips_
ValueError: number bust be greater then zero
How should I write the global function and the snippet to work properly? Sorry for the trouble and thanks for the help.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- UltiSnips Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- SirVer
- Solved:
- Last query:
- Last reply: