这是我的情况我有很多SQL行,如下所示。
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
我想用VIM重新排列它
SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
DELETE FROM blah
DELETE FROM blah
DELETE FROM blah
现在我知道我可以写一个简单的python脚本来快速实现这个目标,但我正在努力提高我的VIM技能。
答案 0 :(得分:7)
您可以使用g命令:
:g/^DELETE/m$
这会将(m)以DELETE开头的所有行移动到文件末尾($)。
答案 1 :(得分:1)