I wansted to add a couple of words more: While diw and dip achieve almost (apart from inserting a space) the desired effect for trimming whitespace,
* This behaviour is not consistent with the definition of W|word and paragraph (it seems that when the cursor resides in whitespace the definition of word and paragraph, bounded from both sides by corresponding whitespace and not vice versa, are negated) * This behaviour does not seem to be documented, and is thus not quite anticipated by the user * Finally, as objects are not part of the classical vi, it seems to be easier to introduce whitespace as a new object and free the def of W|word and paragraph of context dependence. One gains consistence while not braking backward compatibility. On Mon, Nov 23, 2009 at 2:30 AM, Andy Spencer <[email protected]> wrote: > On 2009-11-22 15:59, pepegnu wrote: >> Consider the following situation, you edit the text (underscore >> represents whitespace): >> >> blah-blah-blah_____________________<cursor >> here>___________________blah-blah-blah again >> >> Now, it seems that '_' (underscore) is a free token in the context of >> a text-object. If defined as a new text-object for whitespace, one >> will be able to trim whitespace around the cursor in the example above >> by issuing da_ (mnemonics: delete-a-blank), or ci_ (change-in-blank) >> in normal mode to get >> >> blah-blah-blah blah-blah-blah again > > Does iw (diw, ciw, etc) do what you want? iw it has odd behavior when > using newlines which might not be what you want, but it might work for > tabs and spaces. > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
