Thank you John, but your advice makes me nervous. Does this dot ('.') rule also apply to vimgrep? Or it's only for substitution?
This must be something that only pros use?On Tue, Jan 20, 2015 at 2:48 AM, John Beckett <johnb.beckett@gmail.com> wrote:
Bao Niu wrote:
> in Vim is enclosing your search pattern with "/" recommended?
> The documentation says it is optional. If it's optional then
> why not just forget it?
I would be too nervous to follow Tim's advice, but it seems to
work. Are you aware of the general rule that applies to commands
like :s (substitute)?
An example to replace "hello" with "goodbye":
:%s/hello/goodbye/g
Suppose you need to replace something with slashes in it.
The following attempt to replace "a/b" will NOT WORK:
:%s/a/b/goodbye/g
However, the following will work:
:%s.a/b.goodbye.g
These tips are worth careful study:
http://vim.wikia.com/wiki/Searching
http://vim.wikia.com/wiki/Search_and_replace
John
--
--
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
---
You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/RgAUMOyjGKM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment