Skip to main content

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.

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.

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.

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.

Source Link
Biggybi
  • 2.8k
  • 10
  • 30

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.

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.