Thursday, March 25, 2010

Re: 'w' command to actually move to the next word

Antony Scriven wrote:
> On 26 March 2010 01:56, Tim Chase wrote:
>
>  > Sven Guckes wrote:
>  > >
>  > > * AK <andrei.avk@gmail.com> [2010-03-26 02:11]:
>  > > >
>  > > > Is there any way to get vim's 'w' command
>  > > > (and similar) to move from word to word?
>  >
>  > [...]
>
> Well a complete definition of what the OP meant by `word'
> was not given, but I assumed it to be /\i\+/ which at least
> matched the example give.. Let's go with that for the sake
> of argument.



Yes, \i\+ is what I was looking for.


[snip]
>
> Ha! Yes, once you start doing w then you are compelled to do
> others as well.
>
> Well, if you're doing it properly you should perhaps map
> w to a function. Maybe something along the lines of:
>
>    nno <silent> <buffer> :<C-U>silent call <SID>MyWFunction(v:count1, ...)<CR>
>    ono <silent> ... maybe something slightly different ...
>
> Because you just know that there will be corner cases that
> require special handling.



Indeed, I'm also thinking about that because I find :hlsearch very
useful and doing /\i\+ necessitates mapping :nohl after it, but this
leads to some ugly flicker in gvim. So, if someone more experienced than
me makes a function that'd be awesome; if not, I will eventually make
one myself I guess.

My thinking on this issue is that w/b would be much easier to move
around than f/F in most cases if, well, w/b worked sensibly. The trouble
with w/b is that my brain just doesn't parse a few punctuation chars
together as a word, i.e. if I look at 5-6 vim "words" where a few of
them are real words and a few are bunches of punctuation, they just
don't look as single entities to me - at all! I guess my point is that I
don't mind so much that it doesn't make sense, I just wish w/b were easy
and inuitive to use. F/f seem quite a bit more work as you need to look
for a specific char and then type the same.

Thanks for the responses! -ak

No comments: