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 ?
1 Answer
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.