我有点不懂, 按<Leader>* / <Leader>#
是什么意思呢? On Fri, Jan 14, 2011 at 02:03:36PM +0800, 依云 wrote: > On Thu, Jan 13, 2011 at 09:23:57PM -0800, [email protected] wrote: > > 感谢上次提问得到的帮助,我还有几个问题请教大大们。 > > 举例说来,下面是文本文件: > > ---------- > > 。。。 > > 乙丙丁 戊己庚新 子丑寅卯 甲乙丙丁 > > 乙丙丁 戊己庚新 子丑寅卯 甲乙丙丁 > > 乙丙丁 戊己庚新 子丑寅卯 甲乙丙丁 > > 甲乙丙丁 戊己庚新 子丑寅卯 甲乙丙丁 > > 。。。 > > ---------- > > 问题1:如何用正则只删除以“甲”开头的行、中的空格? > > :g/^甲/s/\s\+//g > 见 :h :g > > > 问题2:用*可以搜索光标下的单词,但是汉语怎么办,我想搜索光标下的“甲”,怎么处理? > > 加入以下映射 > vnoremap <Leader># > "9y?<C-R>='\V'.substitute(escape(@9,'\?'),'\n','\\n','g')<CR><CR> > vnoremap <Leader>* > "9y/<C-R>='\V'.substitute(escape(@9,'\/'),'\n','\\n','g')<CR><CR> > 然后选中文本,按 <Leader>* / <Leader># > > > 问题3:如何用正则复制以“甲”开头的行(并且包括上面三行),再将这四行放到文件末尾。 > > 先将光标移到第一行,然后 > :/^甲/-3,/^甲/copy $ > 见 :h :range 和 :h :copy > > > > > 谢谢指教,我学了些基本正则,但这些比较复杂,俺一时找不到办法。 > > > > -- > Best regards, > lilydjwg > > 我的博客 http://lilydjwg.is-programmer.com/ > > -- > 要退订此论坛,请发邮件至 [email protected] > 更多选项,请通过 http://groups.google.com/group/Vim-cn 访问该论坛 -- 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
