šŸ’¾ 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

View Raw

More Information

ā¬…ļø Previous capture (2023-01-29)

-=-=-=-=-=-=-

Line Moving Semantics

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.