diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 9ad17d1bc2..e9289489bb 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -2552,10 +2552,11 @@ static int get_function_body(exarg_T *eap, garray_T *newlines, char *line_arg_in } if (!is_heredoc) { - // Check for ":let v =<< [trim] EOF" - // and ":let [a, b] =<< [trim] EOF" + // Check for ":cmd v =<< [trim] EOF" + // and ":cmd [a, b] =<< [trim] EOF" + // Where "cmd" can be "let" or "const". arg = p; - if (checkforcmd(&arg, "let", 2)) { + if (checkforcmd(&arg, "let", 2) || checkforcmd(&p, "const", 5)) { int var_count = 0; int semicolon = 0; arg = (char *)skip_var_list(arg, &var_count, &semicolon, true); diff --git a/test/old/testdir/test_map_functions.vim b/test/old/testdir/test_map_functions.vim index 5118063b36..f50347c3c0 100644 --- a/test/old/testdir/test_map_functions.vim +++ b/test/old/testdir/test_map_functions.vim @@ -116,6 +116,19 @@ func Test_maparg() unlet d endfunc +" def Test_vim9_maparg() +" nmap { w +" var one: string = maparg('{') +" assert_equal('w', one) +" var two: string = maparg('{', 'n') +" assert_equal('w', two) +" var three: string = maparg('{', 'n', 0) +" assert_equal('w', three) +" var four: dict = maparg('{', 'n', 0, 1) +" assert_equal(['{', 'w', 'n'], [four.lhs, four.rhs, four.mode]) +" nunmap { +" enddef + func Test_mapcheck() call assert_equal('', mapcheck('a')) call assert_equal('', mapcheck('abc'))