How to add text to the start or end of every line in Vim
Type :%s/$/,/ and press ↵ to add a comma to the end of every line. :%s/^/- / puts - at the start instead. In the pattern, $ means the end of a line and ^ its start.

Four orders were charged twice at Byte Burrito last night. The till's report gives you their numbers, one per line, and they're going into the refund script as an array, so each one needs a comma after it.
:%s/$/,/ does every line at once. It's Vim's find and replace, with % for every line and s for substitute, and $ as the thing to find. In a pattern, $ means the end of the line, the spot just after its last character, so replacing it puts a comma there and takes nothing away. One u takes them all off again.
10411042104510501041,1042,1045,1050,Commas for the refund script
The cursor is on the first order number.
:%s/$/,/ and press ↵refunds.txtThis editor needs a keyboard. Read on, and play it at your computer.
Add text to the start of every line
^ is the start of the line, so :%s/^/- / puts - in front of every line. That turns the kitchen's list of fillings into a bulleted list for the menu page, which is written in Markdown.
The start here is column one, in front of any indent. For indented lines, :normal further down does better.
A bulleted list of fillings
Make the kitchen's list into a bulleted list.
:%s/^/- / with a space after the dash, and press ↵fillings.mdThis editor needs a keyboard. Read on, and play it at your computer.
Wrap every line in quotes
The supplier's order form takes a CSV, and their system wants every name in double quotes. That's text at both ends, and one command still does it. In the pattern, .* matches the whole line, whatever is on it. In the replacement, & stands for whatever matched. So :%s/.*/"&"/ swaps each line for itself with a quote on either side.
Anything can go around the &. :%s/.*/('&'),/ turns carnitas into ('carnitas'),, ready for a SQL insert.
Quotes for the supplier
Wrap the fillings for the supplier, then change your mind.
:%s/.*/"&"/ and press ↵fillings.csvThis editor needs a keyboard. Read on, and play it at your computer.
Add text after the indent, on the lines you select
The shop's settings file lists the fillings under a heading, indented two spaces, and YAML wants - in front of each one. This time only three lines need it, and the dash has to go after the indent, where ^ won't put it.
Select the lines first. V selects the line the cursor is on, and j stretches the selection down. Press : and Vim types :'<,'> for you, which means the selected lines. Every command above works on them, :'<,'>s/$/,/ included.
For the indent, type normal and some keys after it. :normal presses those keys on each line in turn, in Normal mode, starting from the beginning of the line. I starts typing after the indent, so :'<,'>normal I- types the dash where it belongs. A starts typing at the end of the line, so :'<,'>normal A, does what $ did. Vim leaves Insert mode by itself at the end of each line.
Fillings in the settings file
The cursor is on carnitas.
:, type normal I- with a space after the dash, and press ↵shop.ymlThis editor needs a keyboard. Read on, and play it at your computer.
Add text to the end of a few lines with Visual Block
If you'd rather watch it happen, select a column. Press Ctrl-v (hold Ctrl, press v) and move down with j, then press $ to stretch the block to the end of every line, however long each one is. A starts typing after the block. Only the first line shows your text while you type, and the rest fill in when you press Esc.
For the front of the lines, start the block on the first character, leave out the $, and press I instead of A. A block needs the lines to sit together, so it suits a short run like the three lines of this CSS rule that lost their semicolons. Visual Block mode has the rest.
Semicolons for the menu styles
The cursor is on color, the first line without its semicolon.
; and press Escmenu.cssThis editor needs a keyboard. Read on, and play it at your computer.
| Type | Adds |
|---|---|
:%s/$/,/ ↵ | A comma to the end of every line. |
:%s/^/- / ↵ | - to the start of every line, in front of any indent. |
:%s/.*/"&"/ ↵ | A double quote at both ends of every line. |
:%s/.*/('&'),/ ↵ | Brackets, quotes and a comma: carnitas becomes ('carnitas'),. |
:%s/.$/&,/ ↵ | A comma to the end of every line that isn't blank. |
:5,12s/$/;/ ↵ | A semicolon to the end of lines 5 to 12 only. |
:'<,'>s/$/,/ ↵ | A comma to the end of each selected line (press : in Visual mode and Vim types the '<,'>). |
:'<,'>normal A, ↵ | The same, by pressing A and typing a comma on each line. |
:'<,'>normal I- ↵ | - after the indent of each selected line. |
:%norm I# ↵ | # after the indent of every line (:norm is short for :normal). |
:g/./normal A, ↵ | A comma to every line with something on it (:g/./ picks those lines). |
| Ctrl-v, select down, $ A, text, Esc | The text at the end of each line in the block, however long the line. |
| Ctrl-v, select down, I, text, Esc | The text in front of the block, on each line. |
| u | Undoes the whole lot at once. |