thanks, I already tried this and it does not work. It "freezes" the whole editor. (I am using gVim on Win XP, but it should not matter, I believe.)
Yakov Lerner-3 wrote: > > On 10/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Yakov Lerner-3 wrote: >> > >> > On 10/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> >> >> Can you help me please? >> >> I have a long text and I need to find all words beginning with "hell" >> and >> >> copy these words at the end of the file. >> >> I found a helpful command :g/hell/t$ >> >> But this command copies the whole line. I want only the relevant word >> >> (and >> >> each word on a new line). >> > >> > Does the following do what you want, when you press F5: >> > >> > function! CopyHellWords() >> > exe "norm Gmao\<esc>gg" >> > let kount=0 >> > while line('.') <= line("'a") >> > if expand('<cword>') =~ "^hell" >> > call append(line('$'), expand('<cword>')) >> > let kount = kount + 1 >> > endif >> > call search('\<') >> > endw >> > echo kount . "words copied" >> > endfun >> > >> > nmap <F5> :call CopyHellWords()<cr> >> >> thank you - yes, it works absolutely correctly. >> One more question: searching for "hell" for just an example. In fact, I >> need >> to search for V$ >> (i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on). >> What would be correct syntax? I have problem with the "$" sign, of >> course. >> thank you for your help & time. >> > > If you mean V$ at beginning of the word, then > if expand('<cword>') =~ '^V\$' > If you mean V$ anywhere in the word, then > if expand('<cword>') =~ 'V\$' > and then > > Yakov > > -- View this message in context: http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6617059 Sent from the Vim - General mailing list archive at Nabble.com.