Ответ на сообщение «Re: how to display registers 0-9?- concise way & enhanced #,*», присланное в 16:50:14 09 августа 2010, Понедельник, отправитель yosi izaq:
> Any idea re. how to search for WORD with */# shortcuts?- Can I make a
> map like \* \# for that?- Or is there already a common mapping that
> does the same?
There are two ways:
1. Somewhat destructive, but the most simple: yank the word and search for it:
noremap <special> \* yiW/<C-r>=escape(@", '^$*~[]\')<CR>
2. Custom function, like I use in my transliteration plugin to transliterate
current word:
let s:tWregs=[['\(\S*\)', '\(\S\+\|\%$\)'],
\['\(\s*\)', '\(\s*\)' ],]
function s:LRmatch(patlist)
let line=getline('.')
let column=col('.')
let match=[]
let i=0
let lpatlist=len(a:patlist)
while i<lpatlist && (match==[] || match[0]=='')
let pattern=a:patlist[i][0].'\%'.column.'c'.a:patlist[i][1]
let match=matchlist(line, pattern)
let i+=1
endwhile
let lmatch=match[1]
let rmatch=match[2]
return escape(lmatch.rmatch, '^$*~[]\')."\n"
endfunction
" You cannot use script global variables in mappings, but you can
" define a wrapper function
function s:Eval(str)
return eval(a:str)
endfunction
noremap <expr> \* "/".<SID>LRmatch(<SID>Eval('s:tWregs'))
noremap <expr> \# "?".<SID>LRmatch(<SID>Eval('s:tWregs'))
This is a bit complicated, but it does not do anything with registers content
(except current search register @/, of course)
> Your answer to first part if helpful, though I didn't understand
> what's probably Russian.
Yes, it is russian:
Ответ на сообщение «...» -> reply to the message «TOPIC»
присланное в ... -> sent on DATE
отправитель ... -> sender NAME
Текст сообщения: -> Message text:
Текст сообщения:
> On Thu, Aug 5, 2010 at 8:44 PM, ZyX <[email protected]> wrote:
> > Ответ на сообщение <<how to display registers 0-9?- concise way &
> > enhanced #,*>>, присланное в 16:54:56 05 августа 2010, Четверг,
> >
> > отправитель Yosi Izaq:
> > execute 'registers '.join(range(0, 9))
> >
> > ? ``execute'' may be truncated to ``exe'', ``registers'' to ``reg','
> > other part cannot by truncated, but ``j<tab>'' gives ``join('' and
> > ``r<tab>'' gives ``range(''.
> >
> > Текст сообщения:
> >> Hi,
>
> Hi ZyX,
>
> Your answer to first part if helpful, though I didn't understand
> what's probably Russian.
> Thanks!
>
> Any idea re. how to search for WORD with */# shortcuts?- Can I make a
> map like \* \# for that?- Or is there already a common mapping that
> does the same?
>
> Thanks,
> Yosi
signature.asc
Description: This is a digitally signed message part.
