简体   繁体   English

在gvim中从当前点到文件末尾排序?

[英]Sorting from current point to end of file in gvim?

The following in command mode (gvim) 以下命令模式(gvim)

:.,G!sort 

results in 结果是

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

I have stared at this for a little while can someone throw a bone my way or offer a way to do this without resorting to visual mode? 我已经盯着这一段时间了,有人可以用我的方式扔骨头或提供一种方法来做到这一点而不诉诸视觉模式?

I usually use :.,$!sort ; 我通常使用:.,$!sort ; does that work for you? 那对你有用吗?

Original Poster Edit 原始海报编辑

G is not the proper range specification. G不是适当的范围规格。 From the :help range output see below. 从:帮助范围输出见下文。

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.

G is a motion, not a range specifier. G是运动,而不是范围说明符。 See :help range . 请参阅:help range

" vim has internal sort
:.,$sort

"if has numbers use
:.,$sort n

"to delete duplicated lines
:.,$sort u

" read :h sort

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM