> 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.
> A nice thought, but given the OP's original condition, it
> does seem weird that "w" stops where "\<" wouldn't match,
> and where 'iskeyword' isn't a match. [...]
These days it sounds a bit odd saying this but I guess this
is vi-compatible behaviour.
> [...] Even more confusing, if you issue
>
> :match Error /\w/
>
> it doesn't highlight the "<" or "=" characters as "word"
> characters, despite the same usage of "word" in the
> descriptor (per ":help word", a "word" includes sequences
> of non-whitespace non-keyword characters surrounded by
> whitespace). Yes, the help for "\w" explicitly gives the
> character-class, but that seems in conflict with the
> definition of "word". Sigh :-/
Fun fun fun!
> I agree with the Antony's response that, to get the
> "intuitive" behavior of jumping between 'isk'-defined
> "word"s, one would have to do a mapping. I'd likely use
>
> :nnoremap w /\<lt><cr>
> :nnoremap e /\>/e-<cr>
> :nnoremap b ?\<lt><cr>
>
> (and their kin for visual-mode). The only oddity is that
> "w" now respects 'wrapscan'.
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.
> I originally thought the OP was jesting or had some odd
> setting; but tried it (with my default vimrc and with "-u
> NONE") just to make sure, and indeed it doesn't behave as
> I would have expected. I can't say I hit it (the "w" or
> the issue at hand) often because I usually use
> t/T/f/F/;/, for my horizontal jumping, or use the "iw"
> text-object for deleting/changing/visualizing the current
> word.
Well I mostly use / and ? for moving about, but the OP's
question makes a lot of sense to me too. --Antony
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment