Robert Webb schrieb:
>>> :silent! normal! heb
>> Won't work if the word is a single character.
>
> Also won't work at the start of this text: "== blah".
> The idea is to put the cursor at the start of the word that
> expand("<cword>") would return.
>
> This works quite well:
>
> func! Sow()
> if (getline(".")[col(".") - 1] =~ '\k')
> normal wb
> else
> call search('\<', 'sW')
> endif
> endfunc
>
> Except that it may search onto the next line if there are no more words,
> and won't find a non-word sequence at the end of the line if no words exist.
This will find a non-word sequence at the end of the line if no words exist
(improvement of my first function):
func! Sow(vmode)
if a:vmode
normal! gv
endif
let xw = expand("<cword>")
if xw != ""
if xw =~ '\k'
call search('\k\>','cW')
else
call search('[EMAIL PROTECTED]','cW')
endif
if strlen(xw) > 1
normal! b
endif
endif
endfunc
>
> Rob.
--
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---