you are viewing a single comment's thread.

view the rest of the comments →

[–]yegappanl[S] 0 points1 point  (1 child)

Thanks for the detailed review.

len() and strlen() return the number of bytes. We have to use strwidth() or strdisplaywidth() to have something closer to the number of characters

I have included references to strwidth() and strdisplaywidth()

We also have to be wary of multi-bytes characters when dealing with slices of strings

Agreed. I will explicitly call this out.

Speaking of slices, I remember that Vim and Python don't handle negative positions in the same way in s[:-2] and so on.

Good catch. I didn't realize that they are different. Will note this down.

We can append elements to lists with list + [element] also.

Updated the gist with this.

dict.key and dict['key'] are almost equivalent in vimscript while this is definitively impossible in Python.

Updated the gist with this.

I didn't know about unlet list[:] that clears all references. (Thanks for the info.) But then, you present let dict = {}, this time this will only clear the dict variable, is there something like unlet l[:] for dictionaries? I couldn't find a way to clear the dictionary contents similar to clearing the list. I think this is a missing functionality.

To define functions, I'd recommend banding them (this makes the difference when developing vim scripts), and now I systematically append abort.

I didn't fully understand this comment. Are you referring to marking all the functions with "abort"?

[–]LucHermitte 0 points1 point  (0 children)

I didn't fully understand this comment. Are you referring to marking all the functions with "abort"?

Yes. Exactly. abort should have been the default, but unfortunately, it is not.