On 15 déc, 14:39, Christian Brabandt <[email protected]> wrote:
> Hi epanda!
>
> On Di, 15 Dez 2009, epanda wrote:
>
> > I am doing a search like that : search(';;\{1,30}','w')
>
> I don't understand. Where is the cursor? And I don't really understand
> the count logic either.
>
> regards,
> Christian
> --
> hundred-and-one symptoms of being an internet addict:
> 20. When looking at a pageful of someone else's links, you notice all of them
>     are already highlighted in purple.

Sorry, the search command send cursor where occurence is found : here
=>   ;;

cursor is here
            |
           V
;foo1;foo;;bar    => should return 3


I have done this little func but using while and procedural don't
satisfy me.

function! CountCharBeforeCursor(searchedChar)
  let l:c = a:searchedChar
  let l:cpt = 0
  while col('.') > col('^') + 1
    normal h
    if getline('.')[col('.')] ==? l:c
                let l:cpt += 1
    endif
  endwhile
  return l:cpt
endfunction



Now I know exactly how many ; are between my cursor and the begin of
line.

NB : in fact I have to search the nth ; at the line just before.
How can I jump directly to the third ; at the previous line ?


-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to