š¾ Archived View for idiomdrottning.org āŗ line-moving-semantics captured on 2024-05-12 at 16:11:04. Gemini links have been rewritten to link to archived content
ā¬ ļø Previous capture (2023-01-29)
-=-=-=-=-=-=-
In ed, the line editor that the original Unix was written in, you move lines by entering the source and destination numbers with an m in between, like this:
10m5
That will move the line that was the tenth line to now be after the old fifth line and before the old sixth lineāit becomes the new sixth
line. (If you are familiar with edās and sedās general semantics, one way to express it is that m uses a semantics rather than i semantics.)
In mpc, a command line client for the music player daemon, you move lines by entering the source and destination numbers after an mv command, like this:
mpc mv 10 5
That will move the line that was the tenth line to become the new fifth line. Much more intuitive as far as Iām concerned! Iām not proposing we change ed, itās a classic, but this is just a heads up for anyone who uses either or both of those programs.
Iām really happy to use mpc, though! Kudos to whomever implemented it! Pro tip, pipe mpc listās output through nl to get some line numbers.