在vim如何忽略匹配错误,出错信息:“E486 : Pattern not found"

358 views
Skip to first unread message

Tomt

unread,
Jan 5, 2010, 8:32:56 PM1/5/10
to vim...@googlegroups.com
比如说 cmd1=":g/^\\s*$/d" ;cmd2=":%s/zz/aa/ge"
cmd2 可以忽略“E486 : Pattern not found",那么cmd1该怎么处理,

Yongwei Wu

unread,
Jan 5, 2010, 10:21:57 PM1/5/10
to vim...@googlegroups.com
:help :s_flags下找[e]。

2010/1/6 Tomt <tomtf...@gmail.com>:


> 比如说 cmd1=":g/^\\s*$/d" ;cmd2=":%s/zz/aa/ge"
> cmd2 可以忽略"E486 : Pattern not found",那么cmd1该怎么处理,
>

> --
> 要退订此论坛,请发邮件至 Vim-cn-un...@googlegroups.com
> 更多选项,请通过 http://groups.google.com/group/Vim-cn 访问该论坛
>

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

Tomt

unread,
Jan 5, 2010, 10:30:40 PM1/5/10
to vim...@googlegroups.com
谢谢,
      s_flag在global命令中写在什么地方?   在":s"  可以写在"/"后面,":g" 呢?

Tomt

unread,
Jan 5, 2010, 10:32:51 PM1/5/10
to vim...@googlegroups.com
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
:[range]g[lobal]/{pattern}/[cmd]

2010/1/6 Tomt <tomtf...@gmail.com>

Yongwei Wu

unread,
Jan 5, 2010, 10:35:40 PM1/5/10
to vim...@googlegroups.com
:silent g/xxxx/oo
:s/xxx/yyy/e

s_flag当然是用在:s里的。

2010/1/6 Tomt <tomtf...@gmail.com>:


> 谢谢,
> s_flag在global命令中写在什么地方? 在":s" 可以写在"/"后面,":g" 呢?
>

Tomt

unread,
Jan 5, 2010, 10:41:24 PM1/5/10
to vim...@googlegroups.com
谢谢,行了
330.gif
Reply all
Reply to author
Forward
0 new messages