Re: Use Vim 9 script function for indentexpr?

2022-08-11 Thread Lifepillar
On 2022-08-10, Lifepillar  wrote:
> However, a Vim 9 script function does not seem to be called:
>
> vim9script
>
> def BarIndent()
>   echomsg "BarIndent called"
>   return indent(v:lnum - 1) + 4
> enddef
>
> setlocal indentexpr=BarIndent()
>
> Am I doing anything wrong?

Obviously, I do: the correct signature for BarIndent() is:

def BarIndent(): number

Life.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/td2f33%24j9n%241%40ciao.gmane.io.


Use Vim 9 script function for indentexpr?

2022-08-10 Thread Lifepillar
The following silly indent works as expected (of course):

function! FooIndent()
  return indent(v:lnum - 1) + 2
endfunction

setlocal indentexpr=FooIndent()

However, a Vim 9 script function does not seem to be called:

vim9script

def BarIndent()
  echomsg "BarIndent called"
  return indent(v:lnum - 1) + 4
enddef

setlocal indentexpr=BarIndent()

Am I doing anything wrong?

Life.


-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/td145d%24dph%242%40ciao.gmane.io.