Hi all :)

I use Vim to store lists of items, like the one below:

- This is a think I should do, or maybe buy
- Feed my cat
- Tell my cat he is a naughty boy for having chewing up my most
  expensive headphones without having even considered the possibility of
  eating a cheaper pair (or none).
- Write a message to vim_use to ask how to delete items from lists like
  this, where some of the items are oneliners but others are clearly
  not, and may or may not have a final period
- More items, this time an oneliner
- Stop using computers. NOW!

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.

The problem is that, sometimes I want to delete, cut or paste an item.
Deleting, cutting or pasting one-line items is very easy, just dd or yy
and p afterwards. The problem are the multiline items.

Right now I just count the number of lines and use <count>dd, etc. But
this doesn't scale well and doesn't work if the cursor is in the middle
of an item. In those cases I have to go to the beginning of the item,
count the number of lines by hand or use visual mode.

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.

So far, the only solution I've thought of is to add an empty line
between items, thus making Vim think they're paragraphs, and use "dap",
"yap" and p, but I would like Vim doing what I want without having to
adapt my style writing list O:)

Thanks a lot :)

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to