mirror of
https://github.com/neovim/neovim.git
synced 2026-01-23 05:32:45 +10:00
Problem: Changing the return value of getpos() causes an error. (Jie Zhu) Solution: Revert getpos() and add getcurpos(). https://code.google.com/p/vim/source/detail?r=332a5c2b2956d9b18d85268a724d01deea27ec83
67 lines
1.0 KiB
Plaintext
67 lines
1.0 KiB
Plaintext
STARTTEST
|
|
:so small.vim
|
|
:set encoding=latin1
|
|
:set noswapfile
|
|
|
|
:" function name not starting with a capital
|
|
:try
|
|
: func! g:test()
|
|
: echo "test"
|
|
: endfunc
|
|
:catch
|
|
: $put =v:exception
|
|
:endtry
|
|
|
|
:" function name folowed by #
|
|
:try
|
|
: func! test2() "#
|
|
: echo "test2"
|
|
: endfunc
|
|
:catch
|
|
: $put =v:exception
|
|
:endtry
|
|
|
|
:" function name includes a colon
|
|
:try
|
|
: func! b:test()
|
|
: echo "test"
|
|
: endfunc
|
|
:catch
|
|
: $put =v:exception
|
|
:endtry
|
|
|
|
:" function name starting with/without "g:", buffer-local funcref.
|
|
:function! g:Foo(n)
|
|
: $put ='called Foo(' . a:n . ')'
|
|
:endfunction
|
|
:let b:my_func = function('Foo')
|
|
:call b:my_func(1)
|
|
:echo g:Foo(2)
|
|
:echo Foo(3)
|
|
|
|
:" script-local function used in Funcref must exist.
|
|
:so test_eval_func.vim
|
|
|
|
:" using $ instead of '$' must give an error
|
|
:try
|
|
: call append($, 'foobar')
|
|
:catch
|
|
: $put =v:exception
|
|
:endtry
|
|
|
|
:$put ='{{{1 getcurpos/setpos'
|
|
/^012345678
|
|
6l:let sp = getcurpos()
|
|
0:call setpos('.', sp)
|
|
jyl:$put
|
|
|
|
:/^start:/+1,$wq! test.out
|
|
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
:call getchar()
|
|
ENDTEST
|
|
|
|
012345678
|
|
012345678
|
|
|
|
start:
|