Challenge description
Category: rev
Points: 215 (dynamic, calculated from solves)
Solves: 18
This is not compatible with emacs!
Tested with vim 7.4 on amd64 Ubuntu 16.04 (package vim 2:7.4.1689-3ubuntu1.2)
Difficulty: Easy
Preface
There are a lot of words here. If you looked at the challenge during the competition and just missed a few things, you might want to skip ahead to the high-level loop summary section.
Understanding the challenge file
Vim refresher
If you’re a complete Vim beginner, I recommend going through vimtutor
. Just
run it from a shell.
Here’s a list of every command that this challenge uses (all in normal mode):
h
j
k
l
^
$
0
G
f
F
t
Y
y
@
"
r
(only after you get the flag)d
(only after you get the flag)
If you don’t know what some of them do, look them up in Vim’s help like:
:help j
or :h j
. You might also be interested in the general concepts:
count
(and the rest ofnotation
or the wholeintro.txt
file)registers
quote_quote
quote_alpha
and the command :registers
for debugging. As an aside, the most common way
I know to interact with registers is with q
, which puts typed characters into
the given register as a way to record macros. qx
… @x
was a pattern I
learned when I was a beginner, but I didn’t make the connection to registers
for a long time.
Another thing to know is that @
execution will stop when a command fails to
execute. For example, qx0hl@x
will put 0hl
in register "x
and try to run
it, but because 0h
goes to the first character, h
can’t move left and it
will stop executing before moving right with l
. I found this …