bash + vim (56)
Borrowing the Ctrl-XCtrl-E bash trick from Thor's solution, here is how I would do it in bash+vim:
C-XC-E starts default editor (usually vim)
a starts insert mode
.space ASSW
C-Vx4f inserts O
RD
C-Vx5f inserts _
1
C-3 is equivalent to escape (not just in vim, but anywhere in a terminal)
C-X subtracts 1 from the 1
i just typed
a insert mode again
1 C-3
buffer content is now . ASSWORD_01
<< unindent line (a no-op, since line is not indented) and move cursor to 1st column
a
C-X start word completion
C-V complete with ex command
C-V 9 more times selects the entry Print
C-3 back to normal mode
XXXxx deletes rint
(there's a space after the t
that Stackexchange doesn't show)
< < back to column 1
s delete .
, start insert mode
e
c
C-X
C-V ex command completion once again, entry echo
already selected because of the ec
i just typed
space
C-3 buffer content now echo PASSWORD_01
Z
Z save buffer, close vim, bash executes file content, i.e. echo PASSWORD_01
By the way: C-3 has many useful brethren: C-J is Enter, C-I is Tab, C-H is Backspace, C-2 is C-@ (i.e. a null-byte). And for emacs users it is nice to know that Escape followed by another key is equivalent to Alt + that key. So, even without Escape and Alt you can still type Meta-x like this: C-3x