0

I am using the code getline(".")[col(".")-1] to get the character under the cursor. How can I check if the character under the cursor is a tab ?

5

Just compare the character you got with a tab, which can be represented with the \t escape sequence. That is,

getline(".")[col(".")-1] == "\t"

The expression will return 1 if the character is tab, 0 if not.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.