vim中把用正则表达式匹配的字符串写到一个新文件的方法
redirect selected parts to a new file1: :g/patten/y A Append to the
contents of the register if its name is given
uppercase {A-Z}
create a file in vim
"ap
2:delete unwanted lines
:g/^[^0-9]\+\n/d
3: :redir >> tmp
:g/^\d\+/p
:redir END
"send output of previous global command to a new window
:nmap <F5> :redir @a<CR>:g//<CR>:redir END<CR>:new<CR>:put! a<CR><CR>