Сортировка от текущей точки до конца файла в gvim? - PullRequest
3 голосов
/ 21 июня 2009

следующее в командном режиме (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

Я некоторое время смотрел на это, может кто-нибудь бросить мне кость или предложить способ сделать это, не прибегая к визуальному режиму?

Ответы [ 3 ]

11 голосов
/ 21 июня 2009

Я обычно использую :.,$!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.
5 голосов
/ 21 июня 2009

G - это движение, а не спецификатор диапазона. Смотри :help range.

0 голосов
/ 21 августа 2009
" vim has internal sort
:.,$sort

"if has numbers use
:.,$sort n

"to delete duplicated lines
:.,$sort u

" read :h sort

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...