Thursday, September 1, 2011

Re: Check for spaces at the start of the current line

Am 26.08.2011 19:24, schrieb Gerardo Marset:
> I'm looking for a way of knowing wether or not all the characters up
> to the cursor position in the current line are spaces. How would I do
> that?
>
> Thanks!

I'd use the following test (echos 1 (= true) if cursor is on initial
white-space):

:echo virtcol(".")-1 < indent(".")


Example: a mapping for the <Home> key

:noremap <expr> <Home> virtcol(".")-1==indent(".")?"<Bar>":"^"

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment