vim自带排序函数sort, 在命令行模式下执行:help sort 可查看其具体用法,摘录如下:
Vim has a sorting function and a sorting command. The sorting function can be found here: sort(), uniq(). :sor :sort :[range]sor[t][!] [b][f][i][n][o][r][u][x] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. With [!] the order is reversed. With [i] case is ignored. Options [n][f][x][o][b] are mutually exclusive.
example: 忽略大小写,对文件所有行进行排序
:sort i