martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.25k stars 257 forks source link

idea: sam standalone (or better commandline command support) #799

Open SH4R1K7 opened 4 years ago

SH4R1K7 commented 4 years ago

In response to https://github.com/martanne/vis/issues/219#issuecomment-582043238...

This pops into my head from time to time - like a super sed alternative for shell scripts.

Once the sam command has been refined interactively in vis to produce the wanted result, being able to 'replay' non-interactively on multiple files or in automated scripts would be super useful, instead of reverting to duplicating the effort with complicated combinations of the usual sed, awk, etc mishmash (with no interactive/incremental support).

While you can do vis +x/thing/c/this my.file.txt I haven't had much luck with anything more complex - in particular, how to add a :wq?

Just some food for thought...

drwilly commented 4 years ago

So basically ssam?

erf commented 4 years ago

I recently wondered if it was possible to use vis' sam commands to edit multiple files in subfolders by piping a find command to vis and writing the result back to the individual files, but i'm not very familiar with the unix pipes and vis' support for this. I will have to read up on this, but please let me know if this is possible! Thanks

SH4R1K7 commented 4 years ago

ssam is spot on. now all that remains is being tripped up by the small differences and improvements with vis' implementation...

I don't suppose it would be too difficult to add an -e or -f flag to vis? seems like all the functionality is already there in vis to support that kind of automated piping and recreate ssam.

I might poke around on the weekend.