diff options
Diffstat (limited to 'runtime/doc/change.txt')
-rw-r--r-- | runtime/doc/change.txt | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index e8e1caa6a..4aebe30c8 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.0d. Last change: 2006 Apr 09 +*change.txt* For Vim version 7.0d. Last change: 2006 Apr 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1508,7 +1508,7 @@ Vim has a sorting function and a sorting command. The sorting function can be found here: |sort()|. *:sor* *:sort* -:[range]sor[t][!] [i][u][n][x][o] [/{pattern}/] +:[range]sor[t][!] [i][u][r][n][x][o] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. @@ -1517,24 +1517,25 @@ found here: |sort()|. With [i] case is ignored. With [n] sorting is done on the first decimal number - in the line (after a {pattern} match). + in the line (after or inside a {pattern} match). With [x] sorting is done on the first hexadecimal - number in the line (after a {pattern} match). A - leading "0x" or "0X" is ignored. + number in the line (after or inside a {pattern} + match). A leading "0x" or "0X" is ignored. With [o] sorting is done on the first octal number in - the line (after a {pattern} match). + the line (after or inside a {pattern} match). With [u] only keep the first of a sequence of identical lines (ignoring case when [i] is used). + Without this flag, a sequence of identical lines + will be kept in their original order. Note that leading and trailing white space may cause lines to be different. - When /{pattern}/ is specified the text matched with - {pattern} is skipped, so that you sort on what comes - after the match. For lines without a match sorting - starts in the first column (e.g., for empty lines). + When /{pattern}/ is specified and there is no [r] flag + the text matched with {pattern} is skipped, so that + you sort on what comes after the match. Instead of the slash any non-letter can be used. For example, to sort on the second comma-separated field: > @@ -1545,7 +1546,21 @@ found here: |sort()|. < To sort on the first number in the line, no matter what is in front of it: > :sort /.*\ze\d/ -< + +< With [r] sorting is done on the matching {pattern} + instead of skipping past it as described above. + For example, to sort on only the first three letters + of each line: > + :sort /\a\a\a/ r + +< If a {pattern} is used, any lines which don't have a + match for {pattern} are kept in their current order, + but separate from the lines which do match {pattern}. + If you sorted in reverse, they will be in reverse + order after the sorted lines, otherwise they will be + in their original order, right before the sorted + lines. + Note that using ":sort" with ":global" doesn't sort the matching lines, it's quite useless. @@ -1553,8 +1568,8 @@ The details about sorting depend on the library function used. There is no guarantee that sorting is "stable" or obeys the current locale. You will have to try it out. -The sorting itself cannot be interrupted, because of using a system library -function. You can interrupt the preparation (for undo) and putting the sorted -lines into the buffer. In the last case you may end up with duplicated lines. +The sorting can be interrupted, but if you interrupt it too late in the +process you may end up with duplicated lines. This also depends on the system +library function used. vim:tw=78:ts=8:ft=help:norl: |