I know that there is a function col({expr})
, which returns the column position given with {expr}
.
For example, col("$")
gives me the column position of the end of the cursor line.
So I thought col("^")
can give me the column position of the first non-whitespace character of the cursor line. But col("^")
always return 0
.
if xxx
hello|<here is the cursor> world
endif
In the example above, when I execute :echo col("^")
, I always get a 0
, instead of 4
.
Why? BTW, 4 spaces or a tab before the hello
make no difference.
And if col("^")
can't give me the column position of the first non-whitespace character, how could I get it?