Saluton Jürgen :) Jürgen Krämer <[email protected]> skribis: >> As you can see, the list items are preceded by a dash, and are >> justified as shown (no problem, Vim already does that). Whenever I >> modify one of the I can use gqip to reflow that item, and only that >> item is reflown, not the entire text. That's exactly what I want and >> works perfectly. > > I think it only seems to reflow one single item, because you probably > use gqip after every modification of an item. For testing purposes I > copied your example to a freshly started Vim and executed gqip. This > reflowed both the third and the fourth item.
Sorry, I wrote a very crappy explanation of what happens. When I said that gqip only reflows an item I meant that it doesn't convert this: - One item - Another item into: - One item - Another item That is, that gqip considers the "dash" like a non-breaking-space, so to say. > If it did work using dip would have been the answer to your question Of course. Sorry for my explanation, it was quite bad! >> I wondered if I could use some text-object to perform this action >> (maybe changing the "dash" for another character) or some more >> complex command which I could map, whatever, and being able to cut or >> copy an entire item automatically, without having to go to the start >> of the item, not having to count lines, etc. I know how to do this >> using vimscript and a loop, but I wondered if a simpler approach >> exists. > > I don't know too much about text-objects, but you could use this > mapping: > > :nnoremap <buffer> dip ?^\s*-?<cr>d/^\(\s*-\|\s*$\)/-1 > > It searches for the previous dash and deletes lines up to the last > line before the next dash or empty line. I think that it will do perfectly! I'll use it with the modification you suggested after that: adding '$' to the start of the mapping. I'll test this mapping, thanks! -- Raúl "DervishD" Núñez de Arenas Coronado Linux Registered User 88736 | http://www.dervishd.net It's my PC and I'll cry if I want to... RAmen! --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
