On 24/08/08 06:56, Robert Webb wrote:
> Here's what seems like a really stupid question:
>
> What's the simplest way to move the cursor to the start of the word under
> it?
> "Under it" includes the word after the cursor if there's no identifier under
> it.
>
> None of these quite work:
>
> b - The obvious choice, but won't work if the cursor is already on the first
> character or before it.
>
> wb - My usual method. Won't work if the cursor is in the space before the
> word though (nor on a single-character word at the end of the file, although
> I could live with that).
>
> eb - Won't work on last character of word.
>
> *# - OK, I guess this should work, but seems inefficient to do a search.
>
> I'm trying to avoid a more complicated piece of script for such a simple
> operation.
>
> Thanks, and sorry if it is a stupid question with an obvious answer :-)
> Rob.
Here are a few other possibilities, which may or may not be inefficient
too, depending on what you want to do after you're on that first letter:
viw<Esc>`<
viw = character-wise visual inner word
<Esc> = go back to Normal mode
`< = go to start of former Visual area
yiw
yank inner word (but clobbers the default register)
"_yiw
yank inner word to blackhole register. This moves the cursor and does
not actually yank.
It may also depend what you want to do: if you want to yank the word
under the cursor you'll use yiw (possibly with some register other than
the black hole)
Best regards,
Tony.
--
What this country needs is a dime that will buy a good five-cent
bagel.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---