GNU/Linux ◆ screen-256color ◆ bash 1220 views

Moving all SQL DROP statements in a file to the top using a Vim macro.

The macro is recorded using:

qq      # Start recording.
/create # Skip top drop statements by searching for the first create statement.
/drop   # Find the next drop statement.
ddggp   # Move it to the top.
q       # Stop recording.

It can then be run many times over using the normal mode command @q.

More by n2liquid

untitled 00:15

by n2liquid

untitled 01:39

by n2liquid

fave demo. 00:33

by n2liquid

See all