6

How to count the number of whitespace in the beginning of a line ( aka indentation ). eg:

foo()
    foo()

And then

:command(2)
4

1 Answer 1

13

so easy i'm ashamed.

:echo indent(2)
1
  • 6
    And you can use :echo indent('.') / &shiftwidth to get the indent width of the current line (that's what . refers to) divided by the shiftwidth to get the indentation level. Commented May 15, 2015 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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