| 導購 | 订阅 | 在线投稿
分享
 
 
 

vim中把用正則表達式匹配的字符串寫到一個新文件的方法

來源:互聯網  2008-05-21 09:45:29  評論

redirect selected parts to a new file

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

  redirect selected parts to a new file   1: :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>
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有