Results 1 to 4 of 4
Hi all,
I'm trying to do a search and replace inside a visual block as shown below
:s/\%V5043/g
but it gives an error - Invalid character after \%
Obviously, this ...
- 07-14-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 9
VIM visual block search and replace
Hi all,
I'm trying to do a search and replace inside a visual block as shown below
:s/\%V504\503/g
but it gives an error - Invalid character after \%
Obviously, this happens in search too.
/\%V504
But the same works in another machine. So I doubt I'm missing some configuration in VIM or some VIM package needs to be installed. Please help.
--
Regards,
Subith Premdas
- 07-16-2011 #2
Can you give us the text you have, and what you want it changed to?
If you only give us your command, we can only assume what you want based on what is not working.New to the internet, technical forums, or the hacker / open source community??
Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html
RHCE for RHEL version 5
RHCT for RHEL version 4
- 07-17-2011 #3
I suspect that the problem has to do wit the magic settings on the two machines. The magic settings control when you need to provide \ certain search commands:
You might try this:Code:'magic' 'nomagic' 'magic' boolean (default on) global Changes the special characters that can be used in search patterns. See pattern. NOTE: To avoid portability problems with using patterns, always keep this option at the default "on". Only switch it off when working with old Vi scripts. In any other situation write patterns that work when 'magic' is on. Include "\M" when you want to /\M.
Here the pattern is explicitly given a magic setting (with \v), meaning that the % does not require an escape, and that the values of 'magic' will be ignored.Code::%s/\v%V504/503
DISTRO=Arch
Registered Linux User #388732
- 07-25-2011 #4Just Joined!
- Join Date
- Jan 2011
- Posts
- 9
Hi Cabhan,
Thanks for the reply. But this too didn't work.
I get this error E71: Invalid character after \%
Could you please help me how to set this magic settings, or how to check what setting do i currently have so that i can compare two machines and make changes.


Reply With Quote