以下命令模式(gvim)
:.,G!sort
结果
E464: Ambiguous use of user defined-command
:help E464
Ambiguous use of user-defined command There are two user-defined commands with a common name prefix, and you used Command-line completion to execute one of them. |user-cmd-ambiguous| Example: > :command MyCommand1 echo "one" :command MyCommand2 echo "two" :MyCommand Not an editor command
我已经盯着这一段时间了,有人可以按照我的方式扔骨头或提供一种方法来做到这一点而不诉诸视觉模式吗?
答案 0 :(得分:11)
我通常使用:.,$!sort
;这对你有用吗?
原始海报编辑
G不是适当的范围规格。从:帮助范围输出见下文。
Line numbers may be specified with: *:range* *E14* *{address}* {number} an absolute line number . the current line *:.* $ the last line in the file *:$* % equal to 1,$ (the entire file) *:%* 't position of mark t (lowercase) *:'* 'T position of mark T (uppercase); when the mark is in another file it cannot be used in a range /{pattern}[/] the next line where {pattern} matches *:/* ?{pattern}[?] the previous line where {pattern} matches *:?* \/ the next line where the previously used search pattern matches \? the previous line where the previously used search pattern matches \& the next line where the previously used substitute pattern matches Each may be followed (several times) by '+' or '-' and an optional number. This number is added or subtracted from the preceding line number. If the number is omitted, 1 is used.
答案 1 :(得分:5)
G是一个动作,而不是范围说明符。请参阅:help range
。
答案 2 :(得分:0)
" vim has internal sort :.,$sort "if has numbers use :.,$sort n "to delete duplicated lines :.,$sort u " read :h sort