Skip to main content
2 of 4
added 77 characters in body
simzz
  • 510
  • 3
  • 12

Count whitespaces between cursor and preceding non space character

In case I have the following line

// Component: <Component name here>                          |

where | is the cursor marker. How can I count, using vimscript, the total number of white spaces before the cursor until the first non space character (> in this case) ?

The aim is to delete all preceding whitespace before cursor, until non first space character (excluding it).

simzz
  • 510
  • 3
  • 12