Saluton John :)

John Beckett <[email protected]> skribis:
>
> Jürgen Krämer wrote:
>> This mapping has a problem if the cursor is on the dash at the start
>> of an item -- it deletes the previous item. You might want to
>> circumvent this by prepending a $ to the mapping, i.e.
>>
>>   :nnoremap <buffer> dip $?^\s*-?<cr>d/^\(\s*-\|\s*$\)/-1
>
> Sensational! I had to try that, but I think it needs a little tweaking
> to work. I had to double the backslash before the pipe because the
> mapping takes one of the backslashes.

Thanks for checking! Yesterday I didn't have the time to check, so
you've saved a lot of time to me! I wouldn't have noticed the backslash
problem, I'm afraid...

> I use search highlighting and it is irritating how it leaves the
> dashes highlighted. I also added a visual selection thinking
> that you could then press gq to format it, but it doesn't really
> work because the flowed text is not indented after the second
> line. Here is what I ended up with (two lines):
>
>  :nnoremap <buffer> vip $?^\s*-<CR>V/^\(\s*-\\|\s*$\)/-1<CR>:<C-U>noh<CR>gv
>
>  :nnoremap <buffer> dip $?^\s*-<CR>d/^\(\s*-\\|\s*$\)/-1<CR>:<C-U>noh<CR>

Thanks! I'm now putting that on my .vimrc! I've made some changes,
though: since I'm not going to create a filetype for my lists yet just
to put these two mappings, I've put them in .vimrc and changed the dash
for the bullet character I wanted to use: ∙ (this is Ctrl-K Sb), with
no spaces before it (I *never* put spaces before the bullet character.
If I do, then the entry is hierarchically below of the "parent" bullet
and belongs to that item, I want it to be copied/cut with it.

The mappings that finally went into my .vimrc are:

nnoremap <silent> <Leader>d $?^∙<CR>d/^\(∙\\|\s*$\)/-1<CR>:<C-U>noh<CR>
imap     <silent> <Leader>d <C-\><C-O><Leader>d
nnoremap <silent> <Leader>y $?^∙<CR>y/^\(∙\\|\s*$\)/-1<CR>:<C-U>noh<CR>
imap     <silent> <Leader>y <C-\><C-O><Leader>y

This has a problem, though. If I use dashes, then gqip works perfectly
because Vim thinks that everything from "^- " to the next "^- " is a
paragraph. When using the bullet character this doesn't work.

Is this behaviour (treat "^- " specially) hardcoded into vim or picked
from some option like iskeyword, isprint, etc.? I don't mind using a
dash instead of a bullet, but visually a bullet helps me a lot.

BTW, I've tried to add the small bullet to "isprint", causing a segfault
in Vim...

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