I have a function definition in my
.vimrc is sufficient to demonstrate the problem I'm asking about:
function! Greet() echo "hello" endfunction
I want to be able use the same
.vimrc with a version of vim configured with
I don't expect the function to be defined, but I don't want error messages on startup.
Currently, if I run a tiny vim, I get:
Error detected while processing /home/kst/.vimrc: line 1: E319: Sorry, the command is not available in this version: function! Greet() line 2: E319: Sorry, the command is not available in this version: echo "hello" line 3: E319: Sorry, the command is not available in this version: endfunction Press ENTER or type command to continue
I'm looking for something like:
if has("function") function! Greet() echo "hello" endfunction endif
but that doesn't do the job because
has() doesn't recognize
"function". (The result is that the function definition is disabled even for versions of vim that support functions.)
I didn't see anything obvious in the documentation for
has(), and web searches with the word "function" give me a lot of irrelevant hits.