我有一个vim文件,如下所示:
ABBA
Duran Duran
The Beatles
The Rolling Stones
Styx
使用vim的sort命令会产生以下输出:
ABBA
Duran Duran
Styx
The Beatles
The Rolling Stones
我想要做的是在排序时忽略诸如'A'和'The'之类的文章。所以预期的产量会是这样的
ABBA
The Beatles
Duran Duran
The Rolling Stones
Styx
我有一个vim文件,如下所示:
ABBA
Duran Duran
The Beatles
The Rolling Stones
Styx
使用vim的sort命令会产生以下输出:
ABBA
Duran Duran
Styx
The Beatles
The Rolling Stones
我想要做的是在排序时忽略诸如'A'和'The'之类的文章。所以预期的产量会是这样的
ABBA
The Beatles
Duran Duran
The Rolling Stones
Styx
看着 :help :sort
指定/ {pattern} /且没有[r]标志时 跳过与{pattern}匹配的文本,以便 你对比赛结束后的情况进行排序。 可以使用任何非字母而不是斜线。
:sort /^\(A \|The \)*/
这使得:
(ABBA)
The (Beatles)
(Duran Duran)
The (Rolling Stones)
(Styx)