2013-10-24 72 views
0

所以,下面是我的VIM文件的copypasta。它的7000多行長,所以我試圖找到命令來清理它。基本上,我需要換行符才能以P:或F:開頭,但要這樣做,我必須將錯誤地更新到正確行的任何行移動:在下面,以「Nobody can ...」開頭的行需要移回......如何刪除特定換行符

P:  Well at this stage here, I can.t really say for anything really, cause I don.t know anything. $ 
F:  Okay. And that.s my job Rob, my job is to come in here and explain $ 
some stuff to you and then once you.ve a better understanding you can choose whether or not you want to explain that stuff. Alright, because that.s gonna be your choice I.m not gonna force you to say anything. I.m not gonna make you do anything you don.t want to do. $ 
Nobody can ever make you do that, nobody can make Robert $ 
+0

確實%S:^ [PF] \ :: \ r&:work? – tristan

回答

2

使用:v發現不符合任何PF開頭的行,並與前一個投身其中:

:v/^\(P\|F\)/ normal kJ 
+0

好了,我不明白它是如何工作的,但我愛你爲它工作的事實:P什麼會這樣的命令被稱爲這樣我就可以得到關於這個問題的一些學習材料? VIM命令? – Jeff

+0

學習'vim'從頭開始。從你的shell運行'vimtutor'。 – Birei