Reputation: 8109
example:
function! MkStatusLine()
let &stl=''
let &stl.='%{abcd()}'
endfunction
function abcd()
if this
return ' myvalue'
elseif this
return ' '
endif
endfunction
How can I return a space?
return ' ' is seen as return ''
return ' myvalue' is seen as return 'myvalue'
Upvotes: 0
Views: 110
Reputation: 32926
I suspect you are misinterpreting your results and that your function is working correctly. Check what
:echo '#'.abcd().'#'
produces. You should observe # #
and not ##
.
If not, are you sure there is only two paths in your function?
What about the else
path? You can debug it with: :debug echo abcd()
. From there you can go to n
ext instruction, or s
tep-in a function call, or f
inish the call to the current function, you can c
ontinue till next breakpoint, etc. See :h :debug
.
What is sure is that spaces can be returned in VimL. If the first line of your function is a return ' '
, you'll see that a space is returned.
Upvotes: 1