Monday, May 2, 2011

Re: Path easy-search

Am 02.05.2011 04:04, schrieb Ben Schmidt:
>> * what's wrong with "n" and "N"
> ...
>> What I have now in the vimrc:
>>
>> ono m //e<CR>
>> xn <script> m //e<SID>SelOff<CR>
>> cno <expr> <SID>SelOff &sel=="exclusive" ? "+1" : ""
>> " do the right thing after o_//e and .
>> no <script> n //<CR><SID>HistDel
>> no <script> N ??<CR><SID>HistDel
>> sunm n|sunm N
>> nn <silent> <SID>HistDel :call<sid>HistDel(0)<CR>
>> vn <silent> <SID>HistDel :<C-U>call<sid>HistDel(1)<CR>
>> ino <silent> <SID>HistDel <C-R>=<sid>HistDel(0)<CR>
>> func! <sid>HistDel(vmode)
>> if a:vmode
>> normal! gv
>> endif
>> call histdel('/', -1)
>> return ""
>> endfunc
>
> Problem: Folds are not automatically opened any more
> Solution: Add a zv command when "search" is in 'foldopen'
>
> no <script> <expr> n "//<CR>".(&fdo=~"search"?"zv":"")."<SID>HistDel"
> no <script> <expr> N "??<CR>".(&fdo=~"search"?"zv":"")."<SID>HistDel"

He, thanks, that's right.
But I'd use another script mapping to add the zv; for example, at the
moment, one can't do
(Insert mode) Ctrl-O n


ono m //e<CR>
xn <script> m //e<SID>SelOff<CR>

cno <expr> <SID>SelOff &sel=="exclusive" ? "+1" : ""

no <script> n //<CR><SID>zv<SID>HistDel
no <script> N ??<CR><SID>zv<SID>HistDel
sunm n|sunm N

no <expr> <SID>zv &fdo=~"search" ? "zv" : ""
imap <SID>zv <Nop>

nn <silent> <SID>HistDel :call<sid>HistDel(0)<CR>
vn <silent> <SID>HistDel :<C-U>call<sid>HistDel(1)<CR>
ino <silent> <SID>HistDel <C-R>=<sid>HistDel(0)<CR>

func! <sid>HistDel(vmode)
if a:vmode
normal! gv
endif
call histdel('/', -1)
return ""
endfunc


--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment