LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-30-2024, 11:23 AM   #1
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
vi macro wisdom


I am using ex-vi on Slackware (not vim).

I wrote a macro in ~/.exrc to do multiple search & replace commands. Each command is followed by the ^M character (AKA CR). The macro works great if the search matches something. The first search that fails to match something causes the macro to stop running, and it skips the remaining commands.

Example:

Code:
map V :%s:foo:bar:g^M:%s:bletch:frobnotz:g^M:%s:zorkmid:aromdee:g^M
When i press "V", it will search for foo.
If it fails to find foo, then it will quit.
If it finds foo, then it will replace it with bar, and then search for bletch.
And so forth.

Any ideas how to execute the complete macro even if the first command fails to find a match?

Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
#defining a macro inside a macro? saravkrish Programming 1 05-24-2005 09:48 PM
No opening wisdom in slackware 10 lordgorodos Linux - General 5 02-17-2005 09:31 PM
Sage words of Wisdom endorphinjunkie General 9 08-02-2003 11:25 PM
Perl of Wisdom needed for reading in iptables values pjcp64 Programming 5 06-02-2003 05:52 AM
Yoda's words of wisdom MasterC General 10 10-15-2002 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration