(tested on 7.3-RELEASE on amd64 and i386, FWIW, but I suspect the issue is cross-arch, since it also happens in nvi(1) on FreeBSD)
With the following file: $ cat <<EOF > test.txt blank line above pattern line one pattern line two EOF The aim was to copy that first blank line before each of the /pattern/ lines. This works fine in ed(1): $ ed test.txt 52 g/^pattern/1t- ,p blank line above pattern line one pattern line two However, when I use either of these commands in vi(1): :g/^pattern/1t- :g/^pattern/1t.- it errors with Usage: [line [,line]] t line [flags]. Additionally, if I explicitly spell out the relative line count with either :g/^pattern/1t-1 :g/^pattern/1t.-1 it errors with Reference to a line number less than 0 It seems to set the current-line aspect with the absolute line-number of "1" before processing the relative "-" or ".-" (which should be relative to the :g/ match) If I am on one of the /pattern/ lines and issue the same command: 3G :1t- it works as expected, copying the first/blank line before the current line. And strangely, if I do something with the line beforehand (printing it, showing the line-number with `=`, etc), it works too: :g/^pattern/.=|1t- Similarly, if I put the blank line at the bottom of the file: :1m$ :g/^pattern/$t- it also works as expected. FWIW, the initial command works fine in vim. -tkc