Closed ThomasFeher closed 9 years ago
From vims documentation:
*type()*
type({expr}) The result is a Number, depending on the type of {expr}:
Number: 0
String: 1
Funcref: 2
List: 3
Dictionary: 4
Float: 5
To avoid the magic numbers it should be used this way: >
:if type(myvar) == type(0)
:if type(myvar) == type("")
:if type(myvar) == type(function("tr"))
:if type(myvar) == type([])
:if type(myvar) == type({})
:if type(myvar) == type(0.0)
Thus I think you should use type(...) == type("")
.
It would be better if you could fix the problem also for the rare cases, but if you make the above change I will merge the pull request.
Ok, I didn't read the documentation thoroughly enough. That magic number is now fixed. I also tried to improve the commit message to make clear that this commit actually fixes the rare case.
I squashed everything in one commit. I'm not sure whether I have to to make a new pull request now.
Great, thanks! Good work!
Checks if list entry is a string before comparing it to a string. In rare cases this could be a list of strings which results in an error message.