The ==
operator will check for value.
You need to check identity. This is done with the is
(and isnot
) operator. Use is#
to match the case, is?
to ignore it.
For example:
if l:v is v:null
echom "Null"
endif
if l:v isnot v:null
echom "Not null"
endif
There is a list of operators at :h expr4
. You can use e.g :h expr-==
as well, or just :h ==
.
I also recommend reading Effective VimScript from Martin Tournoij.