On 05/07/2010 10:31 PM, niobe wrote:
> Apparently uses the groups of the characters [a-zA-Z_] to define a
> word, e.g. for use by 'b' or 'w' commands.
>
> Since I work a lot with ip addresses I would like vim to be able to
> recognise a valid ip address and treat that as word too (a regexp for
> ip address would be [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} )
>
> Is this possible with vim?
>
The solution I gave in my last reply is not very good. It will mean that
any digits and dots will be counted as words. You might want to look
into an excellent plugin 'motpat' which can be found on vim.org. For
example, here's what I use to only have 'w' and 'b' commands move to
alphanumeric words & ignore punctuation:
call motpat#Map(0, 'w', 'b', '\i\+\ze.\|$')
What this does is that when you hit 'w', it searches ahead for this
pattern, and 'b' searches back. -ak
Friday, May 7, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment