Skip to content

Commit 6f750a9

Browse files
committed
allow funcname which starts with underscore
1 parent 280f30c commit 6f750a9

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

autoload/vimlparser.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ function! s:VimLParser.parse_cmd_function()
13391339
if left.type == s:NODE_IDENTIFIER
13401340
let s = left.value
13411341
let ss = split(s, '\zs')
1342-
if ss[0] !=# '<' && !s:isupper(ss[0]) && stridx(s, ':') == -1 && stridx(s, '#') == -1
1342+
if ss[0] !=# '<' && ss[0] !=# '_' && !s:isupper(ss[0]) && stridx(s, ':') == -1 && stridx(s, '#') == -1
13431343
throw s:Err(printf('E128: Function name must start with a capital or contain a colon: %s', s), left.pos)
13441344
endif
13451345
endif

test/test_funcname.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(function (_F))
2+
(function (s:SID))
3+
(function (<SID>SID))

test/test_funcname.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function _F()
2+
endfunction
3+
4+
function s:SID()
5+
endfunction
6+
7+
function <SID>SID()
8+
endfunction

0 commit comments

Comments
 (0)