├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── AdvancedSorters.manifest ├── README.md ├── autoload └── AdvancedSorters │ ├── Each.vim │ ├── Expr.vim │ ├── Ranges.vim │ ├── Reorder.vim │ └── Uniq.vim ├── doc └── AdvancedSorters.txt ├── plugin └── AdvancedSorters.vim └── tests ├── _setup.vim ├── elements.txt ├── functions.txt ├── lengths.txt ├── t1000-SortRangesByHeader.ok ├── t1000-SortRangesByHeader.vim ├── t1010-SortRangesByHeader-icase,reverse.ok ├── t1010-SortRangesByHeader-icase,reverse.vim ├── t1020-SortRangesByHeader-unique.ok ├── t1020-SortRangesByHeader-unique.vim ├── t1030-SortRangesByHeader-range.ok ├── t1030-SortRangesByHeader-range.vim ├── t1040-SortRangesByHeader-sort-pattern.ok ├── t1040-SortRangesByHeader-sort-pattern.vim ├── t1045-SortRangesByHeader-sort-ipattern.ok ├── t1045-SortRangesByHeader-sort-ipattern.vim ├── t1046-SortRangesByHeader-sort-ipattern.ok ├── t1046-SortRangesByHeader-sort-ipattern.vim ├── t1047-SortRangesByHeader-sort-ipattern.ok ├── t1047-SortRangesByHeader-sort-ipattern.vim ├── t1050-SortRangesByHeader-no-headers.ok ├── t1050-SortRangesByHeader-no-headers.vim ├── t1060-SortByHeader-formatoptions-j.ok ├── t1060-SortByHeader-formatoptions-j.vim ├── t1100-SortRangesByMatch.ok ├── t1100-SortRangesByMatch.vim ├── t1110-SortRangesByMatch-icase,reverse.ok ├── t1110-SortRangesByMatch-icase,reverse.vim ├── t1120-SortRangesByMatch-unique.ok ├── t1120-SortRangesByMatch-unique.vim ├── t1130-SortRangesByMatch-range.ok ├── t1130-SortRangesByMatch-range.vim ├── t1140-SortRangesByMatch-sort-pattern.ok ├── t1140-SortRangesByMatch-sort-pattern.vim ├── t1150-SortRangesByMatch-no-matches.ok ├── t1150-SortRangesByMatch-no-matches.vim ├── t1200-SortRangesByRange.ok ├── t1200-SortRangesByRange.vim ├── t1210-SortRangesByRange-icase,reverse.ok ├── t1210-SortRangesByRange-icase,reverse.vim ├── t1220-SortRangesByRange-unique.ok ├── t1220-SortRangesByRange-unique.vim ├── t1230-SortRangesByRange-range.ok ├── t1230-SortRangesByRange-range.vim ├── t1235-SortRangesByRange-fold.ok ├── t1235-SortRangesByRange-fold.vim ├── t1240-SortRangesByRange-sort-pattern.ok ├── t1240-SortRangesByRange-sort-pattern.vim ├── t1241-SortRangesByRange-sort-pattern.ok ├── t1241-SortRangesByRange-sort-pattern.vim ├── t1242-SortRangesByRange-sort-pattern.ok ├── t1242-SortRangesByRange-sort-pattern.vim ├── t1250-SortRangesByRange-no-ranges.ok ├── t1250-SortRangesByRange-no-ranges.vim ├── t1260-SortRangesByRange-between-marks.ok ├── t1260-SortRangesByRange-between-marks.vim ├── t2000-SortVisible.ok ├── t2000-SortVisible.vim ├── t2010-SortVisible-icase,reverse.ok ├── t2010-SortVisible-icase,reverse.vim ├── t2020-SortVisible-unique.ok ├── t2020-SortVisible-unique.vim ├── t2030-SortVisible-range.ok ├── t2030-SortVisible-range.vim ├── t2035-SortVisible-fold.ok ├── t2035-SortVisible-fold.vim ├── t2040-SortVisible-sort-pattern.ok ├── t2040-SortVisible-sort-pattern.vim ├── t2050-SortVisible-no-folds.ok ├── t2050-SortVisible-no-folds.vim ├── t2055-SortVisible-oneline-folds.ok ├── t2055-SortVisible-oneline-folds.vim ├── t2060-SortVisible-formatoptions-j.ok ├── t2060-SortVisible-formatoptions-j.vim ├── t3000-SortByExpr.ok ├── t3000-SortByExpr.vim ├── t3010-SortByExpr-reverse.ok ├── t3010-SortByExpr-reverse.vim ├── t3020-SortByExpr-constant.ok ├── t3020-SortByExpr-constant.vim ├── t3025-SortByExpr-constant-reverse.ok ├── t3025-SortByExpr-constant-reverse.vim ├── t3030-SortByExpr-val.ok ├── t3030-SortByExpr-val.vim ├── t3040-SortByExpr-range.ok ├── t3040-SortByExpr-range.vim ├── t3100-SortByCharLength.ok ├── t3100-SortByCharLength.vim ├── t3110-SortByCharLength-reverse.ok ├── t3110-SortByCharLength-reverse.vim ├── t3200-SortByWidth.ok ├── t3200-SortByWidth.vim ├── t3210-SortByWidth-reverse.ok ├── t3210-SortByWidth-reverse.vim ├── t3300-SortByExprUnique.ok ├── t3300-SortByExprUnique.vim ├── t3310-SortByExprUnique-reverse.ok ├── t3310-SortByExprUnique-reverse.vim ├── t3320-SortByExprUnique-constant.ok ├── t3320-SortByExprUnique-constant.vim ├── t3325-SortByExprUnique-constant-reverse.ok ├── t3325-SortByExprUnique-constant-reverse.vim ├── t3330-SortByExprUnique-val.ok ├── t3330-SortByExprUnique-val.vim ├── t3340-SortByExprUnique-range.ok ├── t3340-SortByExprUnique-range.vim ├── t3350-SortByExprUnique-no-duplicates.ok ├── t3350-SortByExprUnique-no-duplicates.vim ├── t4000-SortWORDs-line.ok ├── t4000-SortWORDs-line.vim ├── t4010-SortWORDs-range.ok ├── t4010-SortWORDs-range.vim ├── t4020-SortWORDs-multiple-whitespace.ok ├── t4020-SortWORDs-multiple-whitespace.vim ├── t4030-SortWORDs-icase,reverse.ok ├── t4030-SortWORDs-icase,reverse.vim ├── t4040-SortWORDs-unique.ok ├── t4040-SortWORDs-unique.vim ├── t4050-SortWORDs-pattern.ok ├── t4050-SortWORDs-pattern.vim ├── t4100-SortWORDs-single-word.ok ├── t4100-SortWORDs-single-word.vim ├── t4110-SortWORDs-no-word.ok ├── t4110-SortWORDs-no-word.vim ├── t4120-SortWORDs-invalid-args.ok ├── t4120-SortWORDs-invalid-args.vim ├── t4200-SortEach-line.ok ├── t4200-SortEach-line.vim ├── t4210-SortEach-range.ok ├── t4210-SortEach-range.vim ├── t4220-SortEach-first-separator.ok ├── t4220-SortEach-first-separator.vim ├── t4230-SortEach-icase,reverse.ok ├── t4230-SortEach-icase,reverse.vim ├── t4240-SortEach-unique.ok ├── t4240-SortEach-unique.vim ├── t4250-SortEach-pattern.ok ├── t4250-SortEach-pattern.vim ├── t4260-SortEach-lastsearch.ok ├── t4260-SortEach-lastsearch.vim ├── t4270-SortEach-no-elements.vim ├── t5000-UniqAny.ok ├── t5000-UniqAny.vim ├── t5010-UniqAny-range.ok ├── t5010-UniqAny-range.vim ├── t5020-UniqAny-icase.ok ├── t5020-UniqAny-icase.vim ├── t5030-UniqAny-pattern.ok ├── t5030-UniqAny-pattern.vim ├── t5040-UniqAny-pattern-non-matching.ok ├── t5040-UniqAny-pattern-non-matching.vim ├── t5050-UniqAny-pattern-r.ok ├── t5050-UniqAny-pattern-r.vim ├── t5060-UniqAny-pattern-icase-r.ok ├── t5060-UniqAny-pattern-icase-r.vim ├── t5070-UniqAny-invalid-args.vim ├── t5100-UniqSubsequent.ok ├── t5100-UniqSubsequent.vim ├── t5110-UniqSubsequent-range.ok ├── t5110-UniqSubsequent-range.vim ├── t5120-UniqSubsequent-icase.ok ├── t5120-UniqSubsequent-icase.vim ├── t5130-UniqSubsequent-pattern.ok ├── t5130-UniqSubsequent-pattern.vim ├── t5140-UniqSubsequent-pattern-non-matching.ok ├── t5140-UniqSubsequent-pattern-non-matching.vim ├── t5150-UniqSubsequent-pattern-r.ok ├── t5150-UniqSubsequent-pattern-r.vim ├── t5160-UniqSubsequent-pattern-icase-r.ok ├── t5160-UniqSubsequent-pattern-icase-r.vim ├── t5170-UniqSubsequent-invalid-args.vim ├── t6000-ReorderVisible.ok ├── t6000-ReorderVisible.vim ├── t6010-ReorderVisible-no-folds.ok ├── t6010-ReorderVisible-no-folds.vim ├── t6020-ReorderVisible-bad-expr.vim ├── t6030-ReorderVisible-single-fold.ok ├── t6030-ReorderVisible-single-fold.vim ├── t6040-ReorderVisible-range.ok ├── t6040-ReorderVisible-range.vim ├── t6100-ReorderFolded.ok ├── t6100-ReorderFolded.vim ├── t6130-ReorderFolded-single-fold.ok ├── t6130-ReorderFolded-single-fold.vim ├── t6140-ReorderFolded-range.ok ├── t6140-ReorderFolded-range.vim ├── t6200-ReorderUnfolded.ok ├── t6200-ReorderUnfolded.vim ├── t6300-ReorderByHeader.ok ├── t6300-ReorderByHeader.vim ├── t6310-ReorderByHeader-bad.vim ├── t6330-ReorderByHeader-no-match.ok ├── t6330-ReorderByHeader-no-match.vim ├── t6340-ReorderByHeader-range.ok ├── t6340-ReorderByHeader-range.vim ├── t6400-ReorderOnlyByMatch.ok ├── t6400-ReorderOnlyByMatch.vim ├── t6410-ReorderOnlyByMatch-bad.vim ├── t6440-ReorderOnlyByMatch-range.ok ├── t6440-ReorderOnlyByMatch-range.vim ├── t6500-ReorderByMatchAndNonMatches.ok ├── t6500-ReorderByMatchAndNonMatches.vim ├── t6540-ReorderByMatchAndNonMatches-range.ok ├── t6540-ReorderByMatchAndNonMatches-range.vim ├── t6600-ReorderByMatchAndLines.ok ├── t6600-ReorderByMatchAndLines.vim ├── t6640-ReorderByMatchAndLines-range.ok ├── t6640-ReorderByMatchAndLines-range.vim ├── t6700-ReorderOnlyByRange.ok ├── t6700-ReorderOnlyByRange.vim ├── t6710-ReorderOnlyByRange-bad.vim ├── t6730-ReorderOnlyByRange-no-match.vim ├── t6740-ReorderOnlyByRange-range.ok ├── t6740-ReorderOnlyByRange-range.vim ├── t6800-ReorderByRangeAndNonMatches.ok ├── t6800-ReorderByRangeAndNonMatches.vim ├── t6840-ReorderByRangeAndNonMatches-range.ok ├── t6840-ReorderByRangeAndNonMatches-range.vim ├── t6900-ReorderByRangeAndLines.ok ├── t6900-ReorderByRangeAndLines.vim ├── t6940-ReorderByRangeAndLines-range.ok ├── t6940-ReorderByRangeAndLines-range.vim ├── uniq.txt └── words.txt /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: The plugin isn't working at all or shows wrong or unexpected behavior 4 | title: '' 5 | labels: '' 6 | 7 | --- 8 | **Frequent Issues** 9 | 10 | * **E117: Unknown function: ingo#...**: Have you installed the [ingo-library plugin](http://www.vim.org/scripts/script.php?script_id=4433) (or via [GitHub](https://github.com/inkarkat/vim-ingo-library)) as well, as documented in the _dependencies_ section of the readme and plugin help? 11 | * **Sudden problems after updating**: Did you check out the default _master_ branch? Unless you want to participate in feature development and alpha testing, I would recommend that you switch from _master_ to the _stable_ branch; this way, you'll only update to released versions that are (hopefully) better tested and documented. 12 | * **Neovim**: I don't explicitly consider nor test Neovim compatibility; my plugins are written for Vim. If a plugin can be made to work on Neovim with trivial changes, I wouldn't mind including them, but anything more involved should in my opinion be filed as a compatibility bug against Neovim (as its homepage proclaims: _Fully compatible with Vim's editing model and the Vimscript language._) 13 | 14 | **Describe the bug** 15 | 16 | _A clear and concise description of what the bug is._ 17 | 18 | **How to Reproduce** 19 | 20 | _Detailed steps to reproduce the behavior._ 21 | 22 | **Expected Behavior** 23 | 24 | _A clear and concise description of what you expected to happen._ 25 | 26 | **Environment** 27 | - Plugin version (e.g. stable version _1.10_) / revision _a1b2c3d4_ from the master branch 28 | - Dependency versions (e.g. [ingo-library plugin](https://github.com/inkarkat/vim-ingo-library), or external tool versions) 29 | - Vim version (e.g. _8.1.1234_) Or paste the result of `vim --version`. 30 | - OS: (e.g. _Ubuntu 18.04_, _Windows 10 1809_, _macOS 10.14_) 31 | - Install method: (e.g. manually via Vimball or ZIP file, GitHub clone as pack plugin, Plugin manager _NAME_) 32 | - Other plugins / additional context if you think this could be important 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an enhancement for the plugin 4 | title: '' 5 | labels: enhancement 6 | 7 | --- 8 | 9 | **Motivation** 10 | 11 | _A clear and concise description of what currently is hard to do._ 12 | 13 | **Request and Purpose** 14 | 15 | _A clear and concise description of what you want to happen. Possible fit criteria._ 16 | 17 | **Alternatives** 18 | 19 | _A clear and concise description of any alternative solutions or features you've considered._ 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.msgout 2 | *.msgresult 3 | *.out 4 | *.tap 5 | doc/*.description 6 | doc/*.install 7 | tags 8 | -------------------------------------------------------------------------------- /AdvancedSorters.manifest: -------------------------------------------------------------------------------- 1 | autoload/AdvancedSorters/Each.vim 2 | autoload/AdvancedSorters/Expr.vim 3 | autoload/AdvancedSorters/Ranges.vim 4 | autoload/AdvancedSorters/Reorder.vim 5 | autoload/AdvancedSorters/Uniq.vim 6 | plugin/AdvancedSorters.vim 7 | doc/AdvancedSorters.txt 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ADVANCED SORTERS 2 | =============================================================================== 3 | _by Ingo Karkat_ 4 | 5 | DESCRIPTION 6 | ------------------------------------------------------------------------------ 7 | 8 | The built-in :sort command is powerful, but it still is line-based. It 9 | doesn't take into account folded lines, nor can it sort entire blocks like 10 | function definitions, paragraphs, etc. But often, one needs to sort exactly 11 | such areas as single entities, i.e. without changing the line order within 12 | them. A workaround in Vim is condensing each block into a single line, 13 | performing the sorting, and then expanding again. (External, more powerful 14 | sort commands could be used, too.) 15 | 16 | This plugin implements this workaround and encapsulates the three separate 17 | steps in one handy command. 18 | 19 | While :sort has several flags for sorting on various numbers, and a 20 | /{pattern}/ can be specified to skip or sort on, it doesn't allow arbitrary 21 | (Vimscript) expressions. 22 | 23 | This plugin offers extension commands that evaluate an expression per line, 24 | put that number in front of the line, do a numerical sort, and then remove the 25 | temporary number again. Specializations handle the common sort by number of 26 | characters and by the line's display width. 27 | 28 | ### SOURCE 29 | 30 | - [:SortVisible inspiration](http://stackoverflow.com/questions/13554191/sorting-vim-folds) 31 | - [:SortRangesByRange inspiration](http://superuser.com/questions/752032/how-do-i-sort-multiple-blocks-of-text-by-the-first-line-in-each-block-in-vim) 32 | - [:SortByExpr inspiration](http://stackoverflow.com/questions/11531073/how-do-you-sort-a-range-of-lines-by-length) 33 | - [:SortWORDs inspiration](http://stackoverflow.com/questions/26739697/sort-line-horizontally-in-vim) 34 | http://stackoverflow.com/questions/1327978/sorting-words-not-lines-in-vim 35 | 36 | ### SEE ALSO 37 | 38 | - The LineJuggler.vim plugin ([vimscript #4140](http://www.vim.org/scripts/script.php?script_id=4140)) offers many quick mappings to 39 | move around (blocks of) lines. For small data sets, manual shifting may be 40 | quicker than coming up with a correct sort command. 41 | 42 | USAGE 43 | ------------------------------------------------------------------------------ 44 | 45 | :[range]SortVisible[!] [b][f][i][l][n][o][r][u][x] [/{pattern}/] 46 | Sort visible lines in the buffer / [range]. Lines 47 | inside closed folds are kept intact; sorting is done 48 | on all lines of the fold as one unit; i.e. the order 49 | of the other lines inside the fold does _not_ change! 50 | 51 | :[range]SortRangesByHeader[!] /{expr}/ [b][f][i][l][n][o][r][u][x] [/{pattern}/] 52 | Each match of {expr} (in the buffer / [range]) starts 53 | a new area that sorts as one unit; i.e. the order of 54 | the other lines inside the area does _not_ change! 55 | Lines before the first header are sorted individually. 56 | 57 | :[range]SortRangesByMatch[!] /{expr}/ [b][f][i][l][n][o][r][u][x] [/{pattern}/] 58 | Each (multi-line) match of {expr} (in the buffer / 59 | [range]) defines an area that sorts as one unit, 60 | together with individual non-matching lines. 61 | 62 | :[range]SortRangesByRange[!] {range} [b][f][i][l][n][o][r][u][x] [/{pattern}/] 63 | Each {range} (in the buffer / [range]) defines an area 64 | that sorts as one unit. 65 | Note: For this command, /{pattern}/ must be separated 66 | from the {range} by a [b][f][i][l][n][o][r][u][x] flag or a 67 | space; you cannot directly concatenate them. 68 | 69 | Note: The text must not contain embedded 70 | characters (^@) for the above commands! 71 | 72 | :[range]ReorderVisible {reorder-expr} 73 | Reorder visible lines in the buffer / [range] by 74 | collecting into a List of Strings (multiple folded 75 | lines are joined with newlines) and passing it (as 76 | v:val) to {reorder-expr}. 77 | 78 | :[range]ReorderFolded {reorder-expr} 79 | Reorder folded lines in the buffer / [range] by 80 | collecting into a List of Strings (multiple folded 81 | lines are joined with newlines) and passing it (as 82 | v:val) to {reorder-expr}. Those are then re-inserted 83 | in between any unfolded lines, which stay as they 84 | were. 85 | 86 | :[range]ReorderUnfolded {reorder-expr} 87 | Reorder unfolded lines in the buffer / [range] by 88 | collecting into a List of Strings (subsequent unfolded 89 | lines are joined with newlines) and passing it (as 90 | v:val) to {reorder-expr}. Those are then re-inserted 91 | in between any closed folds, which stay as they were. 92 | 93 | :[range]ReorderByHeader /{expr}/ {reorder-expr} 94 | Each match of {expr} (in the buffer / [range]) starts 95 | a new area that is reordered as one unit (joined with 96 | newlines) by passing it (as v:val) to {reorder-expr}. 97 | Lines before the first header are reordered as another 98 | single unit. 99 | 100 | :[range]ReorderOnlyByMatch /{expr}/ {reorder-expr} 101 | Each (multi-line) match of {expr} (in the buffer / 102 | [range]) defines an area that is reordered as one unit 103 | (joined with newlines) by passing it (as v:val) to 104 | {reorder-expr}. Those are then re-inserted in between 105 | any non-matching lines, which stay as they were. 106 | 107 | :[range]ReorderByMatchAndNonMatches /{expr}/ {reorder-expr} 108 | Each (multi-line) match of {expr} (in the buffer / 109 | [range]) defines an area that is reordered as one unit 110 | (joined with newlines), together with units of 111 | non-matching lines, by passing it (as v:val) to 112 | {reorder-expr}. 113 | 114 | :[range]ReorderByMatchAndLines /{expr}/ {reorder-expr} 115 | Each (multi-line) match of {expr} (in the buffer / 116 | [range]) defines an area that is reordered as one unit 117 | (joined with newlines), together with individual 118 | non-matching lines, by passing it (as v:val) to 119 | {reorder-expr}. 120 | 121 | :[range]ReorderOnlyByRange {range} {reorder-expr} 122 | Each {range} (in the buffer / [range]) defines an area 123 | that is reordered as one unit (joined with newlines), 124 | by passing it (as v:val) to {reorder-expr}. Those are 125 | then re-inserted in between any non-matching lines, 126 | which stay as they were. 127 | 128 | :[range]ReorderByRangeAndNonMatches {range} {reorder-expr} 129 | Each {range} (in the buffer / [range]) defines an area 130 | that is reordered as one unit (joined with newlines), 131 | together with individual non-matching lines, by 132 | passing it (as v:val) to {reorder-expr}. 133 | 134 | :[range]ReorderByRangeAndLines {range} {reorder-expr} 135 | Each {range} (in the buffer / [range]) defines an area 136 | that is reordered as one unit (joined with newlines), 137 | together with individual non-matching lines, by 138 | passing it (as v:val) to {reorder-expr}. 139 | 140 | :[range]SortByExpr[!] {expr} 141 | Sort lines in [range] by the {expr}, which should take 142 | the current line as input via v:val and return a 143 | number. With [!] the order is reversed. 144 | 145 | :[range]SortByExprUnique[!] {expr} 146 | Sort lines in [range] by the {expr}; only the first 147 | line that gets a certain number from {expr} is kept. 148 | With [!] the order is reversed. 149 | 150 | :[range]SortByCharLength[!] 151 | Sort lines in [range] by the number of characters. 152 | 153 | :[range]SortByWidth[!] 154 | Sort lines in [range] by the display width. 155 | 156 | :[range]SortEach /{delimiter-pattern}/[{joiner}/] 157 | :[range]SortEach /{delimiter-pattern}/[{joiner}]/ [b][f][i][l][n][o][r][u][x] /{pattern}/ 158 | Sort individual elements delimited by 159 | {delimiter-pattern} (or newlines) in the current line 160 | / [range], and join them back together with the first 161 | matching delimiter [or {joiner}]. 162 | 163 | :[range]SortWORDs[!] [b][f][i][l][n][o][r][u][x] [/{pattern}/] 164 | Sort individual (whitespace-delimited) WORDs in the 165 | current line / [range]. 166 | 167 | :[range]UniqAny [i][r] [/{pattern}/] 168 | Remove lines in [range] that have already been 169 | encountered earlier (not necessarily adjacent). 170 | With [i] case is ignored. 171 | When /{pattern}/ is specified and there is no [r] flag 172 | the text matched with {pattern} is ignored. 173 | With [r] only the matching {pattern} is considered; 174 | the rest is ignored. 175 | If a {pattern} is used, any lines which don't have a 176 | match for {pattern} are kept. 177 | 178 | :[range]UniqSubsequent [i][r] [/{pattern}/] 179 | Remove second and succeeding copies of repeated 180 | adjacent lines in [range]. 181 | With [i] case is ignored. 182 | When /{pattern}/ is specified and there is no [r] flag 183 | the text matched with {pattern} is ignored. 184 | With [r] only the matching {pattern} is considered; 185 | the rest is ignored. 186 | If a {pattern} is used, any lines which don't have a 187 | match for {pattern} are kept. 188 | 189 | ### EXAMPLE 190 | 191 | We're taking any Vimscript file with multiple function definitions as an 192 | example, and show how to sort whole functions according to function name (and 193 | arguments). 194 | 195 | To use folding, we first have to define the folds, then trigger the sorting: 196 | 197 | :g/^function/,/^endfunction/fold 198 | :SortVisible 199 | 200 | If we don't care about including any lines after the "endfunction", we can 201 | just base the areas on the function start: 202 | 203 | :SortRangesByHeader /^function/ 204 | 205 | But we'll get better results with an explicit end. One way is to define a 206 | multi-line pattern that covers the entire function: 207 | 208 | :SortRangesByMatch /^function\_.\{-}\nendfunction$/ 209 | 210 | Another way spans up a range, similar to what we've done above to define the 211 | folds: 212 | 213 | :SortRangesByRange /^function/,/^endfunction$/ 214 | 215 | INSTALLATION 216 | ------------------------------------------------------------------------------ 217 | 218 | The code is hosted in a Git repo at 219 | https://github.com/inkarkat/vim-AdvancedSorters 220 | You can use your favorite plugin manager, or "git clone" into a directory used 221 | for Vim packages. Releases are on the "stable" branch, the latest unstable 222 | development snapshot on "master". 223 | 224 | This script is also packaged as a vimball. If you have the "gunzip" 225 | decompressor in your PATH, simply edit the \*.vmb.gz package in Vim; otherwise, 226 | decompress the archive first, e.g. using WinZip. Inside Vim, install by 227 | sourcing the vimball or via the :UseVimball command. 228 | 229 | vim AdvancedSorters*.vmb.gz 230 | :so % 231 | 232 | To uninstall, use the :RmVimball command. 233 | 234 | ### DEPENDENCIES 235 | 236 | - Requires Vim 7.0 or higher. 237 | - Requires the ingo-library.vim plugin ([vimscript #4433](http://www.vim.org/scripts/script.php?script_id=4433)), version 1.043 or 238 | higher. 239 | 240 | CONTRIBUTING 241 | ------------------------------------------------------------------------------ 242 | 243 | Report any bugs, send patches, or suggest features via the issue tracker at 244 | https://github.com/inkarkat/vim-AdvancedSorters/issues or email (address 245 | below). 246 | 247 | HISTORY 248 | ------------------------------------------------------------------------------ 249 | 250 | ##### 1.31 10-Nov-2024 251 | - Adapt: Support new [b][f][l] sort flags (introduced in Vim 7.4.1027, 252 | 7.4.1143, 8.2.1933). 253 | 254 | __You need to update to ingo-library ([vimscript #4433](http://www.vim.org/scripts/script.php?script_id=4433)) version 1.043!__ 255 | 256 | ##### 1.30 03-Feb-2020 257 | - CHG: Rename :Uniq to :UniqAny and add :UniqSubsequent variant. 258 | - Add :SortEach generalization of :SortWORDs. 259 | - CHG: Rename :SortUnfolded to :SortVisible. 260 | - ENH: Add various :ReorderBy... commands that mirror the :SortVisible and 261 | :SortRangedBy... commands, but allow arbitrary reorderings via a Vimscript 262 | expression. 263 | 264 | __You need to update to ingo-library ([vimscript #4433](http://www.vim.org/scripts/script.php?script_id=4433)) version 1.039!__ 265 | 266 | ##### 1.21 26-Oct-2016 267 | - BUG: :SortUnfolded and :SortRangedBy... remove comment sigils (like "#") 268 | when 'formatoptions' contains "j". Temporarily reset 'formatoptions' to 269 | avoid interference of user settings. Thanks to Holger Mitschke for reporting 270 | this! 271 | 272 | ##### 1.20 09-Feb-2015 273 | - Add :Uniq command. 274 | - Also support [/{pattern}/] [i][u][r][n][x][o] :sort argument order (and 275 | mixed). 276 | - FIX: Include missing Words.vim module that prevented the :SortWORDs command 277 | introduced in the previous version 1.10 from functioning. 278 | 279 | ##### 1.10 23-Dec-2014 280 | - Add :SortWORDs command. 281 | 282 | ##### 1.02 06-Nov-2014 283 | - BUG: :.SortRangesBy... doesn't work correctly on a closed fold; need to use 284 | ingo#range#NetStart(). 285 | 286 | __You need to update to ingo-library ([vimscript #4433](http://www.vim.org/scripts/script.php?script_id=4433)) version 1.022!__ 287 | 288 | ##### 1.01 10-Jul-2014 289 | - Make :SortRangesByRange work for Vim versions before 7.4.218 that don't have 290 | uniq(). 291 | 292 | __You need to update to ingo-library ([vimscript #4433](http://www.vim.org/scripts/script.php?script_id=4433)) version 1.021!__ 293 | 294 | ##### 1.00 11-Jun-2014 295 | - First published version. 296 | 297 | ##### 0.01 18-Jul-2012 298 | - Started development. 299 | 300 | ------------------------------------------------------------------------------ 301 | Copyright: (C) 2012-2024 Ingo Karkat - 302 | The [VIM LICENSE](http://vimdoc.sourceforge.net/htmldoc/uganda.html#license) applies to this plugin. 303 | 304 | Maintainer: Ingo Karkat <ingo@karkat.de> 305 | -------------------------------------------------------------------------------- /autoload/AdvancedSorters/Each.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters/Each.vim: Sort individual elements instead of full lines. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo-library.vim plugin 5 | " 6 | " Copyright: (C) 2014-2019 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | let s:save_cpo = &cpo 11 | set cpo&vim 12 | 13 | function! s:SortEach( what, bang, startLnum, endLnum, separatorPattern, joiner, sortArguments ) abort 14 | " Unjoin lines, delete indent and trailing whitespace. 15 | execute printf('silent %d,%dsubstitute/%s/\r/g', a:startLnum, a:endLnum, escape(a:separatorPattern, '/')) 16 | let [l:endLnum, l:lineNum] = [line("']"), line('$')] 17 | 18 | " Remove completely empty lines. 19 | execute printf('silent %d,%dglobal/^$/delete _', a:startLnum, l:endLnum) 20 | call histdel('search', -1) 21 | 22 | let l:deletedLineNum = l:lineNum - line('$') 23 | let l:endLnum -= l:deletedLineNum 24 | if l:endLnum < a:startLnum 25 | silent! undo 26 | call ingo#err#Set(printf('No %s to sort', a:what)) 27 | return 0 28 | endif 29 | 30 | try 31 | let l:lineNum = line('$') 32 | execute printf('silent %d,%dsort%s %s', a:startLnum, l:endLnum, a:bang, a:sortArguments) 33 | let l:duplicatedNum = l:lineNum - line('$') 34 | let l:endLnum -= l:duplicatedNum 35 | 36 | if a:joiner ==# "\n" 37 | execute printf('silent %d,%djoin', a:startLnum, l:endLnum) 38 | else 39 | call ingo#join#Range(1, ingo#range#NetStart(a:startLnum), l:endLnum, a:joiner) 40 | endif 41 | return 1 42 | catch /^Vim\%((\a\+)\)\=:/ 43 | silent! undo 44 | call ingo#err#SetVimException() 45 | return 0 46 | endtry 47 | endfunction 48 | 49 | function! s:GetFirstDelimiter( startLnum, endLnum, separatorPattern ) abort 50 | let [l:startLnum, l:endLnum] = [ingo#range#NetStart(a:startLnum), ingo#range#NetEnd(a:endLnum)] 51 | return matchstr(join(getline(l:startLnum, l:endLnum), "\n"), a:separatorPattern) 52 | endfunction 53 | function! AdvancedSorters#Each#Command( bang, startLnum, endLnum, arguments ) abort 54 | let [l:separator, l:separatorPattern, l:joiner, l:sortArgs] = ingo#cmdargs#substitute#Parse(a:arguments, 55 | \ {'flagsExpr': AdvancedSorters#Ranges#GetSortArgumentsExpr(5, '*'), 'emptyFlags': '', 'emptyReplacement': '', 'isAllowLoneFlags': 0} 56 | \) 57 | let l:separatorPattern = (empty(l:separatorPattern) ? 58 | \ ingo#escape#Unescape(@/, '/') : 59 | \ ingo#escape#Unescape(l:separatorPattern, l:separator) 60 | \) 61 | let l:joiner = (empty(l:joiner) ? 62 | \ s:GetFirstDelimiter(a:startLnum, a:endLnum, l:separatorPattern) : 63 | \ ingo#escape#Unescape(l:joiner, l:separator) 64 | \) 65 | 66 | return s:SortEach('elements', a:bang, a:startLnum, a:endLnum, l:separatorPattern, l:joiner, l:sortArgs) 67 | endfunction 68 | 69 | function! AdvancedSorters#Each#WORD( bang, startLnum, endLnum, arguments ) abort 70 | return s:SortEach('WORDs', a:bang, a:startLnum, a:endLnum, '\s\+\|\s\+\n\s*\|\s*\n\s\+', "\n", a:arguments) 71 | endfunction 72 | 73 | let &cpo = s:save_cpo 74 | unlet s:save_cpo 75 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 76 | -------------------------------------------------------------------------------- /autoload/AdvancedSorters/Expr.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters/Expr.vim: Sorting by a custom expression. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/actions.vim autoload script 5 | " - ingo/err.vim autoload script 6 | " 7 | " Copyright: (C) 2014-2019 Ingo Karkat 8 | " The VIM LICENSE applies to this script; see ':help copyright'. 9 | " 10 | " Maintainer: Ingo Karkat 11 | 12 | function! AdvancedSorters#Expr#Sort( startLnum, endLnum, isReverse, isUnique, expr ) 13 | try 14 | if type(a:expr) == type(function('tr')) 15 | silent execute a:startLnum . ',' . a:endLnum . 'substitute/^.*$/\= call(' . string(a:expr) . ',[submatch(0)]) . " " . submatch(0)/' 16 | else 17 | silent execute a:startLnum . ',' . a:endLnum . 'substitute/^.*$/\=' . substitute(a:expr, '\C' . ingo#actions#GetValExpr(), 'submatch(0)', 'g') . ' . " " . submatch(0)/' 18 | endif 19 | execute a:startLnum . ',' . a:endLnum . 'sort' . (a:isReverse ? '!' : '') 'n' 20 | 21 | let l:lastLnum = line('$') " When the a:isUnique flag is passed, duplicate lines reduce the number of lines. 22 | let l:sortOffset = 0 " Account for the reduced end line number when undoing the numbering. 23 | if a:isUnique 24 | silent execute (a:startLnum + 1) . ',' . a:endLnum . 'g/^/if matchstr(getline(line(".") - 1), "^\\d\\+ ") ==# matchstr(getline("."), "^\\d\\+ ") | silent delete _ | endif' 25 | let l:sortOffset = line('$') - l:lastLnum 26 | endif 27 | 28 | silent execute a:startLnum . ',' . (a:endLnum + l:sortOffset) . 'substitute/^\d\+ //' 29 | return 1 30 | catch /^Vim\%((\a\+)\)\=:/ 31 | call ingo#err#SetVimException() 32 | silent! undo 33 | return 0 34 | finally 35 | call histdel('search', -1) 36 | endtry 37 | endfunction 38 | 39 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 40 | -------------------------------------------------------------------------------- /autoload/AdvancedSorters/Ranges.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters/Ranges.vim: Sorting of whole ranges as one unit. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo-library.vim plugin 5 | " 6 | " Copyright: (C) 2014-2021 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | let s:save_cpo = &cpo 11 | set cpo&vim 12 | 13 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 14 | if a:rangeNum <= 0 15 | call ingo#err#Set(printf('No %s found', a:rangeName)) 16 | return 0 17 | endif 18 | 19 | let l:reducedEndLnum = a:endLnum - a:joinCnt 20 | let l:lastLnum = line('$') " When the "u" flag is passed, duplicate lines reduce the number of lines. 21 | let l:sortOffset = 0 " Account for the reduced end line number when undoing the join. 22 | try 23 | execute printf('%d,%dsort%s %s', a:startLnum, l:reducedEndLnum, a:bang, a:sortArgs) 24 | let l:sortOffset = line('$') - l:lastLnum 25 | return 1 26 | catch /^Vim\%((\a\+)\)\=:/ 27 | call ingo#err#SetVimException() 28 | return 0 29 | finally 30 | silent execute printf('%d,%dsubstitute/\%%d0/\r/ge', a:startLnum, l:reducedEndLnum + l:sortOffset) 31 | call histdel('search', -1) 32 | endtry 33 | endfunction 34 | function! AdvancedSorters#Ranges#Visible( bang, startLnum, endLnum, sortArgs ) 35 | let [l:startLnum, l:endLnum] = [ingo#range#NetStart(a:startLnum), ingo#range#NetEnd(a:endLnum)] 36 | 37 | let l:save_formatoptions = &l:formatoptions 38 | setlocal formatoptions= 39 | try 40 | let [l:foldNum, l:joinCnt] = ingo#join#FoldedLines(1, l:startLnum, l:endLnum, "\\") 41 | finally 42 | let &l:formatoptions = l:save_formatoptions 43 | endtry 44 | 45 | return s:SortRanges(a:bang, l:startLnum, l:endLnum, a:sortArgs, 'folds', l:foldNum, l:joinCnt) 46 | endfunction 47 | 48 | let s:sortFlagsExpr = '[bfilnorux[:space:]]' 49 | function! AdvancedSorters#Ranges#GetSortArgumentsExpr( captureNum, flagsBeforePatternCardinality, ... ) 50 | return '\s*\(' . 51 | \ s:sortFlagsExpr . a:flagsBeforePatternCardinality . 52 | \ '\%(\([[:alnum:]\\"|]\@![\x00-\xFF]\)\(.\{-}\)\%(\%(^\|[^\\]\)\%(\\\\\)*\\\)\@\", l:ranges) 69 | finally 70 | let &l:formatoptions = l:save_formatoptions 71 | endtry 72 | 73 | return s:SortRanges(a:bang, l:startLnum, l:endLnum, l:sortArgs, a:rangeName, l:rangeNum, l:joinCnt) 74 | endfunction 75 | 76 | 77 | 78 | function! AdvancedSorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 79 | return s:JoinRanges(a:bang, a:startLnum, a:endLnum, a:arguments, function('s:ParseExpressionAndSortArguments'), 'headers', function('ingo#ranges#FromHeader')) 80 | endfunction 81 | 82 | function! AdvancedSorters#Ranges#ByMatch( bang, startLnum, endLnum, arguments ) 83 | return s:JoinRanges(a:bang, a:startLnum, a:endLnum, a:arguments, function('s:ParseExpressionAndSortArguments'), 'matches', function('ingo#ranges#FromMatch')) 84 | endfunction 85 | 86 | function! s:ParseRangeAndSortArguments( arguments ) 87 | " Since both the range and the sort arguments can contain a /{pattern}/, 88 | " parsing is difficult. It's easier when there's a sort flag or whitespace 89 | " in between, so look for such first. 90 | let l:parsedRange = ingo#cmdargs#range#Parse(a:arguments, {'isParseFirstRange': 1, 'commandExpr': AdvancedSorters#Ranges#GetSortArgumentsExpr(5, '\+') . '$'}) 91 | if empty(l:parsedRange) 92 | " Else, take the entire arguments as a range, with only optional sort 93 | " flags allowed (but no sort pattern). This means that here, there 94 | " *must* be a space or a sort flag between the /{pat1}/,/{pat2}/ range 95 | " and the /{pattern}/ sort argument. 96 | let l:parsedRange = ingo#cmdargs#range#Parse(a:arguments, {'isParseFirstRange': 1, 'commandExpr': '\s*\(' . s:sortFlagsExpr . '*\)$'}) 97 | endif 98 | 99 | if empty(l:parsedRange) 100 | return ['', ''] 101 | endif 102 | return l:parsedRange[3:4] 103 | endfunction 104 | function! AdvancedSorters#Ranges#ByRange( bang, startLnum, endLnum, arguments ) 105 | return s:JoinRanges(a:bang, a:startLnum, a:endLnum, a:arguments, function('s:ParseRangeAndSortArguments'), 'ranges', function('ingo#ranges#FromRange')) 106 | endfunction 107 | 108 | let &cpo = s:save_cpo 109 | unlet s:save_cpo 110 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 111 | -------------------------------------------------------------------------------- /autoload/AdvancedSorters/Reorder.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters/Reorder.vim: Reordering of whole ranges as one unit. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo-library.vim plugin 5 | " 6 | " Copyright: (C) 2019-2021 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | let s:save_cpo = &cpo 11 | set cpo&vim 12 | 13 | function! s:GetJoinedTextFromRange( range ) abort 14 | return (a:range[0] == a:range[1] ? 15 | \ getline(a:range[0]) : 16 | \ join(getline(a:range[0], a:range[1]), "\n") 17 | \) 18 | endfunction 19 | function! s:GetLinesFromRanges( ranges ) abort 20 | return map(a:ranges, 's:GetJoinedTextFromRange(v:val)') 21 | endfunction 22 | 23 | function! s:ReorderLines( lines, expr ) abort 24 | return ingo#actions#EvaluateWithVal(a:expr, a:lines) 25 | endfunction 26 | 27 | function! s:IdentityRanges( startLnum, endLnum, ranges ) abort 28 | return [a:ranges, -1] 29 | endfunction 30 | 31 | function! s:RangesAndNonMatches( startLnum, endLnum, ranges ) abort 32 | call extend(a:ranges, ingo#range#invert#Invert(a:startLnum, a:endLnum, a:ranges)) 33 | return ingo#range#sort#AscendingByStartLnum(a:ranges) 34 | endfunction 35 | function! s:RangesAndLines( startLnum, endLnum, ranges ) abort 36 | call extend(a:ranges, s:SingleLineRanges(ingo#range#invert#Invert(a:startLnum, a:endLnum, a:ranges))) 37 | return ingo#range#sort#AscendingByStartLnum(a:ranges) 38 | endfunction 39 | 40 | function! s:GetNextStartLnum( ranges ) abort 41 | return get(a:ranges, 0, [0x7FFFFFFF, 0x7FFFFFFF])[0] 42 | endfunction 43 | 44 | function! s:AddIndividualLines( startLnum, endLnum, ranges ) abort 45 | let l:lnum = a:startLnum 46 | let l:result = [] 47 | while l:lnum <= a:endLnum 48 | if s:GetNextStartLnum(a:ranges) == l:lnum 49 | let l:range = remove(a:ranges, 0) 50 | call add(l:result, l:range) 51 | let l:lnum = l:range[1] + 1 52 | else 53 | call add(l:result, [l:lnum, l:lnum]) 54 | let l:lnum += 1 55 | endif 56 | endwhile 57 | return l:result 58 | endfunction 59 | function! s:WithIndividualLines( startLnum, endLnum, ranges ) abort 60 | return [s:AddIndividualLines(a:startLnum, a:endLnum, a:ranges), -1] 61 | endfunction 62 | 63 | function! s:ReorderOriginalRanges( startLnum, endLnum, ranges ) abort 64 | return [a:ranges, 0] 65 | endfunction 66 | function! s:ReorderOtherRanges( startLnum, endLnum, ranges ) abort 67 | return [a:ranges, 1] 68 | endfunction 69 | function! s:Weave( modifiedRanges, modifiedLines, otherRanges ) abort 70 | let l:result = [] 71 | while ! empty(a:modifiedRanges) || ! empty(a:otherRanges) 72 | if s:GetNextStartLnum(a:modifiedRanges) < s:GetNextStartLnum(a:otherRanges) 73 | call remove(a:modifiedRanges, 0) 74 | call add(l:result, remove(a:modifiedLines, 0)) 75 | else 76 | let l:range = remove(a:otherRanges, 0) 77 | call add(l:result, s:GetJoinedTextFromRange(l:range)) 78 | endif 79 | endwhile 80 | return l:result 81 | endfunction 82 | 83 | function! s:NothingToReorderError() abort 84 | call ingo#err#Set('Just a single range; nothing to reorder') 85 | return 0 86 | endfunction 87 | function! s:Command( GetRanges, Ranger, startLnum, endLnum, arguments, ... ) abort 88 | try 89 | let [l:startLnum, l:endLnum] = [ingo#range#NetStart(a:startLnum), ingo#range#NetEnd(a:endLnum)] 90 | let l:initialRanges = call(a:GetRanges, [l:startLnum, l:endLnum] + a:000) 91 | let [l:reorderRanges, l:otherRangesIndex] = call(a:Ranger, [l:startLnum, l:endLnum, l:initialRanges]) 92 | if l:otherRangesIndex == -1 93 | if len(l:reorderRanges) <= 1 94 | return s:NothingToReorderError() 95 | endif 96 | 97 | let l:lines = s:ReorderLines(s:GetLinesFromRanges(l:reorderRanges), a:arguments) 98 | else 99 | let l:rangesPair = [ingo#range#invert#Invert(l:startLnum, l:endLnum, l:reorderRanges)] 100 | call insert(l:rangesPair, l:initialRanges, l:otherRangesIndex) 101 | if len(l:rangesPair[0]) + len(l:rangesPair[1]) <= 1 102 | return s:NothingToReorderError() 103 | endif 104 | 105 | let l:reorderedLines = s:ReorderLines(s:GetLinesFromRanges(copy(l:rangesPair[0])), a:arguments) 106 | let l:lines = s:Weave(l:rangesPair[0], l:reorderedLines, l:rangesPair[1]) 107 | endif 108 | call ingo#lines#Replace(l:startLnum, l:endLnum, l:lines) 109 | return 1 110 | catch /^Vim\%((\a\+)\)\=:/ 111 | call ingo#err#SetVimException() 112 | return 0 113 | endtry 114 | endfunction 115 | function! s:FoldedCommand( Ranger, startLnum, endLnum, arguments ) abort 116 | return s:Command(function('ingo#folds#GetClosedFolds'), a:Ranger, a:startLnum, a:endLnum, a:arguments) 117 | endfunction 118 | 119 | 120 | 121 | function! AdvancedSorters#Reorder#Visible( startLnum, endLnum, arguments ) abort 122 | return s:FoldedCommand(function('s:WithIndividualLines'), a:startLnum, a:endLnum, a:arguments) 123 | endfunction 124 | 125 | function! AdvancedSorters#Reorder#Folded( startLnum, endLnum, arguments ) abort 126 | return s:FoldedCommand(function('s:ReorderOriginalRanges'), a:startLnum, a:endLnum, a:arguments) 127 | endfunction 128 | 129 | function! AdvancedSorters#Reorder#Unfolded( startLnum, endLnum, arguments ) abort 130 | return s:FoldedCommand(function('s:ReorderOtherRanges'), a:startLnum, a:endLnum, a:arguments) 131 | endfunction 132 | 133 | function! s:ParsePatternAndExpression( arguments ) abort 134 | let [l:separator, l:escapedPattern, l:expression] = ingo#cmdargs#pattern#Parse(a:arguments, '\s*\(.\{-}\)\s*') 135 | if empty(l:expression) 136 | throw 'ParsePatternAndExpression: Must pass both /{expr}/ and {reorder-expr}' 137 | elseif empty(l:escapedPattern) 138 | let [l:separator, l:pattern] = ['/', @/] 139 | endif 140 | 141 | let l:pattern = ingo#escape#Unescape(l:escapedPattern, l:separator) 142 | call histadd('search', escape(l:pattern, '/')) 143 | return [l:pattern, l:expression] 144 | endfunction 145 | function! s:PatternAndExpressionCommand( GetRanges, Ranger, startLnum, endLnum, arguments ) abort 146 | try 147 | let [l:pattern, l:reorderExpr] = s:ParsePatternAndExpression(a:arguments) 148 | catch /^ParsePatternAndExpression:/ 149 | call ingo#err#SetCustomException('ParsePatternAndExpression') 150 | return 0 151 | endtry 152 | 153 | return s:Command(a:GetRanges, a:Ranger, a:startLnum, a:endLnum, l:reorderExpr, l:pattern) 154 | endfunction 155 | function! s:RangesFromHeader( startLnum, endLnum, expr ) abort 156 | let l:ranges = ingo#ranges#FromHeader(a:startLnum, a:endLnum, a:expr) 157 | let l:firstStartLnum = s:GetNextStartLnum(l:ranges) 158 | if l:firstStartLnum != a:startLnum 159 | call insert(l:ranges, [a:startLnum, l:firstStartLnum - 1], 0) 160 | endif 161 | 162 | return l:ranges 163 | endfunction 164 | function! AdvancedSorters#Reorder#ByHeader( startLnum, endLnum, arguments ) abort 165 | return s:PatternAndExpressionCommand( 166 | \ function('s:RangesFromHeader'), function('s:WithIndividualLines'), 167 | \ a:startLnum, a:endLnum, a:arguments 168 | \) 169 | endfunction 170 | 171 | function! AdvancedSorters#Reorder#OnlyByMatch( startLnum, endLnum, arguments ) abort 172 | return s:PatternAndExpressionCommand( 173 | \ function('ingo#ranges#FromMatch'), function('s:ReorderOriginalRanges'), 174 | \ a:startLnum, a:endLnum, a:arguments 175 | \) 176 | endfunction 177 | 178 | function! s:RangesFromMatchAndNonMatches( startLnum, endLnum, expr ) abort 179 | return s:RangesAndNonMatches(a:startLnum, a:endLnum, ingo#ranges#FromMatch(a:startLnum, a:endLnum, a:expr)) 180 | endfunction 181 | function! AdvancedSorters#Reorder#ByMatchAndNonMatches( startLnum, endLnum, arguments ) abort 182 | return s:PatternAndExpressionCommand( 183 | \ function('s:RangesFromMatchAndNonMatches'), function('s:IdentityRanges'), 184 | \ a:startLnum, a:endLnum, a:arguments 185 | \) 186 | endfunction 187 | 188 | function! s:SingleLineRanges( ranges ) abort 189 | return ingo#collections#Flatten1(map(a:ranges, 's:ExpandRange(v:val)')) 190 | endfunction 191 | function! s:ExpandRange( range ) abort 192 | return map(range(a:range[0], a:range[1]), '[v:val, v:val]') 193 | endfunction 194 | function! s:RangesFromMatchAndLines( startLnum, endLnum, expr ) abort 195 | return s:RangesAndLines(a:startLnum, a:endLnum, ingo#ranges#FromMatch(a:startLnum, a:endLnum, a:expr)) 196 | endfunction 197 | function! AdvancedSorters#Reorder#ByMatchAndLines( startLnum, endLnum, arguments ) abort 198 | return s:PatternAndExpressionCommand( 199 | \ function('s:RangesFromMatchAndLines'), function('s:IdentityRanges'), 200 | \ a:startLnum, a:endLnum, a:arguments 201 | \) 202 | endfunction 203 | 204 | function! s:ParseRangeAndExpression( arguments ) abort 205 | let l:parsedRange = ingo#cmdargs#range#Parse(a:arguments, {'isParseFirstRange': 1, 'commandExpr': '\s\+\(.\{-}\)\s*$'}) 206 | if empty(l:parsedRange) 207 | throw 'ParseRangeAndExpression: Must pass both {range} and {reorder-expr}' 208 | endif 209 | 210 | return l:parsedRange[3:4] 211 | endfunction 212 | function! s:RangeAndExpressionCommand( GetRanges, Ranger, startLnum, endLnum, arguments ) abort 213 | try 214 | let [l:range, l:reorderExpr] = s:ParseRangeAndExpression(a:arguments) 215 | catch /^ParseRangeAndExpression:/ 216 | call ingo#err#SetCustomException('ParseRangeAndExpression') 217 | return 0 218 | endtry 219 | 220 | return s:Command(a:GetRanges, a:Ranger, a:startLnum, a:endLnum, l:reorderExpr, l:range) 221 | endfunction 222 | function! AdvancedSorters#Reorder#OnlyByRange( startLnum, endLnum, arguments ) abort 223 | return s:RangeAndExpressionCommand( 224 | \ function('ingo#ranges#FromRange'), function('s:ReorderOriginalRanges'), 225 | \ a:startLnum, a:endLnum, a:arguments 226 | \) 227 | endfunction 228 | 229 | function! s:RangesFromRangeAndNonMatches( startLnum, endLnum, range ) abort 230 | return s:RangesAndNonMatches(a:startLnum, a:endLnum, ingo#ranges#FromRange(a:startLnum, a:endLnum, a:range)) 231 | endfunction 232 | function! AdvancedSorters#Reorder#ByRangeAndNonMatches( startLnum, endLnum, arguments ) abort 233 | return s:RangeAndExpressionCommand( 234 | \ function('s:RangesFromRangeAndNonMatches'), function('s:IdentityRanges'), 235 | \ a:startLnum, a:endLnum, a:arguments 236 | \) 237 | endfunction 238 | 239 | function! s:RangesFromRangeAndLines( startLnum, endLnum, range ) abort 240 | return s:RangesAndLines(a:startLnum, a:endLnum, ingo#ranges#FromRange(a:startLnum, a:endLnum, a:range)) 241 | endfunction 242 | function! AdvancedSorters#Reorder#ByRangeAndLines( startLnum, endLnum, arguments ) abort 243 | return s:RangeAndExpressionCommand( 244 | \ function('s:RangesFromRangeAndLines'), function('s:IdentityRanges'), 245 | \ a:startLnum, a:endLnum, a:arguments 246 | \) 247 | endfunction 248 | 249 | let &cpo = s:save_cpo 250 | unlet s:save_cpo 251 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 252 | -------------------------------------------------------------------------------- /autoload/AdvancedSorters/Uniq.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters/Uniq.vim: Keep unique lines. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/actions.vim autoload script 5 | " - ingo/cmdargs/pattern.vim autoload script 6 | " - ingo/collections.vim autoload script 7 | " - ingo/compat.vim autoload script 8 | " - ingo/lines.vim autoload script 9 | " - ingo/range.vim autoload script 10 | " 11 | " Copyright: (C) 2015-2019 Ingo Karkat 12 | " The VIM LICENSE applies to this script; see ':help copyright'. 13 | " 14 | " Maintainer: Ingo Karkat 15 | 16 | function! s:Parse( arguments ) 17 | let l:uniqFlagsExpr = '[ir[:space:]]' 18 | let [l:flagsBeforePattern, l:restArguments] = matchlist(a:arguments, '^\(' . l:uniqFlagsExpr . '*\)\(.*\)$')[1:2] 19 | let [l:pattern, l:flagsAfterPattern] = ingo#cmdargs#pattern#ParseUnescaped(l:restArguments, '\(' . l:uniqFlagsExpr . '*\)') 20 | return [l:flagsBeforePattern . l:flagsAfterPattern, l:pattern] 21 | endfunction 22 | function! s:Uniq( UniqFuncref, startLnum, endLnum, arguments ) 23 | let [l:startLnum, l:endLnum] = [ingo#range#NetStart(a:startLnum), ingo#range#NetEnd(a:endLnum)] 24 | 25 | let [l:flags, l:pattern] = ['', ''] 26 | if ! empty(a:arguments) 27 | let [l:flags, l:pattern] = s:Parse(a:arguments) 28 | if l:pattern ==# a:arguments 29 | " The parsing should have removed the /.../ delimiters; the argument 30 | " either has none, or the argument syntax is wrong. 31 | call ingo#err#Set('Invalid argument: ' . a:arguments) 32 | return 0 33 | endif 34 | endif 35 | 36 | let l:modificationExpr = 'v:val' 37 | if ! empty(l:pattern) 38 | if l:flags =~# 'r' 39 | let l:modificationExpr = printf("matchstr(v:val, %s)", string(l:pattern)) 40 | else 41 | let l:modificationExpr = printf("v:val =~# %s ? substitute(v:val, %s, '', 'g') : ''", string(l:pattern), string(l:pattern)) 42 | endif 43 | endif 44 | if l:flags =~# 'i' 45 | let l:modificationExpr = 'tolower(' . l:modificationExpr . ')' 46 | endif 47 | 48 | let l:lines = call(a:UniqFuncref, [getline(l:startLnum, l:endLnum), l:modificationExpr]) 49 | call ingo#lines#Replace(l:startLnum, l:endLnum, l:lines) 50 | return 1 51 | endfunction 52 | 53 | function! s:MakeUniqueAny( lines, modificationExpr ) 54 | if a:modificationExpr ==# 'v:val' 55 | return ingo#collections#UniqueStable(a:lines) 56 | endif 57 | 58 | let l:itemDict = {} 59 | let l:result = [] 60 | let l:nonMatching = [] 61 | for l:line in a:lines 62 | let l:key = (l:line ==# '' ? "\" : ingo#actions#EvaluateWithVal(a:modificationExpr, l:line)) 63 | if empty(l:key) 64 | call add(l:result, l:line) 65 | elseif ! has_key(l:itemDict, l:key) 66 | let l:itemDict[l:key] = 1 67 | call add(l:result, l:line) 68 | endif 69 | endfor 70 | return l:result 71 | endfunction 72 | function! AdvancedSorters#Uniq#UniqAny( startLnum, endLnum, arguments ) 73 | return s:Uniq(function('s:MakeUniqueAny'), a:startLnum, a:endLnum, a:arguments) 74 | endfunction 75 | 76 | function! s:MakeUniqueSubsequent( lines, modificationExpr ) 77 | if a:modificationExpr ==# 'v:val' 78 | return ingo#compat#uniq(a:lines) 79 | endif 80 | 81 | let l:result = [] 82 | let l:nonMatching = [] 83 | for l:line in a:lines 84 | let l:key = (l:line ==# '' ? '' : ingo#actions#EvaluateWithVal(a:modificationExpr, l:line)) 85 | if empty(l:key) 86 | call add(l:result, l:line) 87 | elseif ! exists('l:previousItem') || l:previousItem !=# l:key 88 | call add(l:result, l:line) 89 | endif 90 | let l:previousItem = l:key 91 | endfor 92 | return l:result 93 | endfunction 94 | function! AdvancedSorters#Uniq#UniqSubsequent( startLnum, endLnum, arguments ) 95 | return s:Uniq(function('s:MakeUniqueSubsequent'), a:startLnum, a:endLnum, a:arguments) 96 | endfunction 97 | 98 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 99 | -------------------------------------------------------------------------------- /doc/AdvancedSorters.txt: -------------------------------------------------------------------------------- 1 | *AdvancedSorters.txt* Sorting of certain areas or by special needs. 2 | 3 | ADVANCED SORTERS by Ingo Karkat 4 | *AdvancedSorters.vim* 5 | description |AdvancedSorters-description| 6 | usage |AdvancedSorters-usage| 7 | installation |AdvancedSorters-installation| 8 | limitations |AdvancedSorters-limitations| 9 | known problems |AdvancedSorters-known-problems| 10 | todo |AdvancedSorters-todo| 11 | history |AdvancedSorters-history| 12 | 13 | ============================================================================== 14 | DESCRIPTION *AdvancedSorters-description* 15 | 16 | The built-in |:sort| command is powerful, but it still is line-based. It 17 | doesn't take into account folded lines, nor can it sort entire blocks like 18 | function definitions, paragraphs, etc. But often, one needs to sort exactly 19 | such areas as single entities, i.e. without changing the line order within 20 | them. A workaround in Vim is condensing each block into a single line, 21 | performing the sorting, and then expanding again. (External, more powerful 22 | sort commands could be used, too.) 23 | 24 | This plugin implements this workaround and encapsulates the three separate 25 | steps in one handy command. 26 | 27 | 28 | While |:sort| has several flags for sorting on various numbers, and a 29 | /{pattern}/ can be specified to skip or sort on, it doesn't allow arbitrary 30 | (Vimscript) expressions. 31 | 32 | This plugin offers extension commands that evaluate an expression per line, 33 | put that number in front of the line, do a numerical sort, and then remove the 34 | temporary number again. Specializations handle the common sort by number of 35 | characters and by the line's display width. 36 | 37 | SOURCE * 38 | 39 | - :SortVisible inspired by 40 | http://stackoverflow.com/questions/13554191/sorting-vim-folds 41 | - :SortRangesByRange inspired by 42 | http://superuser.com/questions/752032/how-do-i-sort-multiple-blocks-of-text-by-the-first-line-in-each-block-in-vim 43 | - :SortByExpr inspired by 44 | http://stackoverflow.com/questions/11531073/how-do-you-sort-a-range-of-lines-by-length 45 | - :SortWORDs inspired by 46 | http://stackoverflow.com/questions/26739697/sort-line-horizontally-in-vim 47 | http://stackoverflow.com/questions/1327978/sorting-words-not-lines-in-vim 48 | 49 | SEE ALSO * 50 | 51 | - The |LineJuggler.vim| plugin (vimscript #4140) offers many quick mappings to 52 | move around (blocks of) lines. For small data sets, manual shifting may be 53 | quicker than coming up with a correct sort command. 54 | 55 | ============================================================================== 56 | USAGE *AdvancedSorters-usage* 57 | *:SortVisible* 58 | :[range]SortVisible[!] [b][f][i][l][n][o][r][u][x] [/{pattern}/] 59 | Sort visible lines in the buffer / [range]. Lines 60 | inside closed folds are kept intact; sorting is done 61 | on all lines of the fold as one unit; i.e. the order 62 | of the other lines inside the fold does _not_ change! 63 | *:SortRangesByHeader* 64 | :[range]SortRangesByHeader[!] /{expr}/ [b][f][i][l][n][o][r][u][x] [/{pattern}/] 65 | Each match of {expr} (in the buffer / [range]) starts 66 | a new area that sorts as one unit; i.e. the order of 67 | the other lines inside the area does _not_ change! 68 | Lines before the first header are sorted individually. 69 | *:SortRangesByMatch* 70 | :[range]SortRangesByMatch[!] /{expr}/ [b][f][i][l][n][o][r][u][x] [/{pattern}/] 71 | Each (multi-line) match of {expr} (in the buffer / 72 | [range]) defines an area that sorts as one unit, 73 | together with individual non-matching lines. 74 | *:SortRangesByRange* 75 | :[range]SortRangesByRange[!] {range} [b][f][i][l][n][o][r][u][x] [/{pattern}/] 76 | Each {range} (in the buffer / [range]) defines an area 77 | that sorts as one unit. 78 | Note: For this command, /{pattern}/ must be separated 79 | from the {range} by a [b][f][i][l][n][o][r][u][x] flag or a 80 | space; you cannot directly concatenate them. 81 | 82 | Note: The text must not contain embedded 83 | characters (^@) for the above commands! 84 | 85 | *:ReorderVisible* 86 | :[range]ReorderVisible {reorder-expr} 87 | Reorder visible lines in the buffer / [range] by 88 | collecting into a List of Strings (multiple folded 89 | lines are joined with newlines) and passing it (as 90 | v:val) to {reorder-expr}. 91 | *:ReorderFolded* 92 | :[range]ReorderFolded {reorder-expr} 93 | Reorder folded lines in the buffer / [range] by 94 | collecting into a List of Strings (multiple folded 95 | lines are joined with newlines) and passing it (as 96 | v:val) to {reorder-expr}. Those are then re-inserted 97 | in between any unfolded lines, which stay as they 98 | were. 99 | *:ReorderUnfolded* 100 | :[range]ReorderUnfolded {reorder-expr} 101 | Reorder unfolded lines in the buffer / [range] by 102 | collecting into a List of Strings (subsequent unfolded 103 | lines are joined with newlines) and passing it (as 104 | v:val) to {reorder-expr}. Those are then re-inserted 105 | in between any closed folds, which stay as they were. 106 | *:ReorderByHeader* 107 | :[range]ReorderByHeader /{expr}/ {reorder-expr} 108 | Each match of {expr} (in the buffer / [range]) starts 109 | a new area that is reordered as one unit (joined with 110 | newlines) by passing it (as v:val) to {reorder-expr}. 111 | Lines before the first header are reordered as another 112 | single unit. 113 | *:ReorderOnlyByMatch* 114 | :[range]ReorderOnlyByMatch /{expr}/ {reorder-expr} 115 | Each (multi-line) match of {expr} (in the buffer / 116 | [range]) defines an area that is reordered as one unit 117 | (joined with newlines) by passing it (as v:val) to 118 | {reorder-expr}. Those are then re-inserted in between 119 | any non-matching lines, which stay as they were. 120 | *:ReorderByMatchAndNonMatches* 121 | :[range]ReorderByMatchAndNonMatches /{expr}/ {reorder-expr} 122 | Each (multi-line) match of {expr} (in the buffer / 123 | [range]) defines an area that is reordered as one unit 124 | (joined with newlines), together with units of 125 | non-matching lines, by passing it (as v:val) to 126 | {reorder-expr}. 127 | *:ReorderByMatchAndLines* 128 | :[range]ReorderByMatchAndLines /{expr}/ {reorder-expr} 129 | Each (multi-line) match of {expr} (in the buffer / 130 | [range]) defines an area that is reordered as one unit 131 | (joined with newlines), together with individual 132 | non-matching lines, by passing it (as v:val) to 133 | {reorder-expr}. 134 | *:ReorderOnlyByRange* 135 | :[range]ReorderOnlyByRange {range} {reorder-expr} 136 | Each {range} (in the buffer / [range]) defines an area 137 | that is reordered as one unit (joined with newlines), 138 | by passing it (as v:val) to {reorder-expr}. Those are 139 | then re-inserted in between any non-matching lines, 140 | which stay as they were. 141 | *:ReorderByRangeAndNonMatches* 142 | :[range]ReorderByRangeAndNonMatches {range} {reorder-expr} 143 | Each {range} (in the buffer / [range]) defines an area 144 | that is reordered as one unit (joined with newlines), 145 | together with individual non-matching lines, by 146 | passing it (as v:val) to {reorder-expr}. 147 | *:ReorderByRangeAndLines* 148 | :[range]ReorderByRangeAndLines {range} {reorder-expr} 149 | Each {range} (in the buffer / [range]) defines an area 150 | that is reordered as one unit (joined with newlines), 151 | together with individual non-matching lines, by 152 | passing it (as v:val) to {reorder-expr}. 153 | 154 | *:SortByExpr* 155 | :[range]SortByExpr[!] {expr} 156 | Sort lines in [range] by the {expr}, which should take 157 | the current line as input via v:val and return a 158 | number. With [!] the order is reversed. 159 | *:SortByExprUnique* 160 | :[range]SortByExprUnique[!] {expr} 161 | Sort lines in [range] by the {expr}; only the first 162 | line that gets a certain number from {expr} is kept. 163 | With [!] the order is reversed. 164 | *:SortByCharLength* 165 | :[range]SortByCharLength[!] 166 | Sort lines in [range] by the number of characters. 167 | *:SortByWidth* 168 | :[range]SortByWidth[!] 169 | Sort lines in [range] by the display width. 170 | 171 | *:SortEach* 172 | :[range]SortEach /{delimiter-pattern}/[{joiner}/] 173 | :[range]SortEach /{delimiter-pattern}/[{joiner}]/ [b][f][i][l][n][o][r][u][x] /{pattern}/ 174 | Sort individual elements delimited by 175 | {delimiter-pattern} (or newlines) in the current line 176 | / [range], and join them back together with the first 177 | matching delimiter [or {joiner}]. 178 | *:SortWORDs* 179 | :[range]SortWORDs[!] [b][f][i][l][n][o][r][u][x] [/{pattern}/] 180 | Sort individual (whitespace-delimited) |WORDs| in the 181 | current line / [range]. 182 | 183 | *:UniqAny* 184 | :[range]UniqAny [i][r] [/{pattern}/] 185 | Remove lines in [range] that have already been 186 | encountered earlier (not necessarily adjacent). 187 | With [i] case is ignored. 188 | When /{pattern}/ is specified and there is no [r] flag 189 | the text matched with {pattern} is ignored. 190 | With [r] only the matching {pattern} is considered; 191 | the rest is ignored. 192 | If a {pattern} is used, any lines which don't have a 193 | match for {pattern} are kept. 194 | *:UniqSubsequent* 195 | :[range]UniqSubsequent [i][r] [/{pattern}/] 196 | Remove second and succeeding copies of repeated 197 | adjacent lines in [range]. 198 | With [i] case is ignored. 199 | When /{pattern}/ is specified and there is no [r] flag 200 | the text matched with {pattern} is ignored. 201 | With [r] only the matching {pattern} is considered; 202 | the rest is ignored. 203 | If a {pattern} is used, any lines which don't have a 204 | match for {pattern} are kept. 205 | 206 | EXAMPLE *AdvancedSorters-example* 207 | 208 | We're taking any Vimscript file with multiple function definitions as an 209 | example, and show how to sort whole functions according to function name (and 210 | arguments). 211 | 212 | To use folding, we first have to define the folds, then trigger the sorting: > 213 | :g/^function/,/^endfunction/fold 214 | :SortVisible 215 | 216 | If we don't care about including any lines after the "endfunction", we can 217 | just base the areas on the function start: > 218 | :SortRangesByHeader /^function/ 219 | But we'll get better results with an explicit end. One way is to define a 220 | multi-line pattern that covers the entire function: > 221 | :SortRangesByMatch /^function\_.\{-}\nendfunction$/ 222 | Another way spans up a range, similar to what we've done above to define the 223 | folds: > 224 | :SortRangesByRange /^function/,/^endfunction$/ 225 | < 226 | ============================================================================== 227 | INSTALLATION *AdvancedSorters-installation* 228 | 229 | The code is hosted in a Git repo at 230 | https://github.com/inkarkat/vim-AdvancedSorters 231 | You can use your favorite plugin manager, or "git clone" into a directory used 232 | for Vim |packages|. Releases are on the "stable" branch, the latest unstable 233 | development snapshot on "master". 234 | 235 | This script is also packaged as a |vimball|. If you have the "gunzip" 236 | decompressor in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, 237 | decompress the archive first, e.g. using WinZip. Inside Vim, install by 238 | sourcing the vimball or via the |:UseVimball| command. > 239 | vim AdvancedSorters*.vmb.gz 240 | :so % 241 | To uninstall, use the |:RmVimball| command. 242 | 243 | DEPENDENCIES *AdvancedSorters-dependencies* 244 | 245 | - Requires Vim 7.0 or higher. 246 | - Requires the |ingo-library.vim| plugin (vimscript #4433), version 1.043 or 247 | higher. 248 | 249 | ============================================================================== 250 | LIMITATIONS *AdvancedSorters-limitations* 251 | 252 | KNOWN PROBLEMS *AdvancedSorters-known-problems* 253 | 254 | TODO *AdvancedSorters-todo* 255 | 256 | IDEAS *AdvancedSorters-ideas* 257 | 258 | CONTRIBUTING *AdvancedSorters-contribute* 259 | 260 | Report any bugs, send patches, or suggest features via the issue tracker at 261 | https://github.com/inkarkat/vim-AdvancedSorters/issues or email (address 262 | below). 263 | 264 | ============================================================================== 265 | HISTORY *AdvancedSorters-history* 266 | 267 | 1.31 10-Nov-2024 268 | - Adapt: Support new [b][f][l] sort flags (introduced in Vim 7.4.1027, 269 | 7.4.1143, 8.2.1933). 270 | *** You need to update to ingo-library (vimscript #4433) version 1.043! *** 271 | 272 | 1.30 03-Feb-2020 273 | - CHG: Rename :Uniq to :UniqAny and add :UniqSubsequent variant. 274 | - Add :SortEach generalization of :SortWORDs. 275 | - CHG: Rename :SortUnfolded to :SortVisible. 276 | - ENH: Add various :ReorderBy... commands that mirror the :SortVisible and 277 | :SortRangedBy... commands, but allow arbitrary reorderings via a Vimscript 278 | expression. 279 | *** You need to update to ingo-library (vimscript #4433) version 1.039! *** 280 | 281 | 1.21 26-Oct-2016 282 | - BUG: :SortUnfolded and :SortRangedBy... remove comment sigils (like "#") 283 | when 'formatoptions' contains "j". Temporarily reset 'formatoptions' to 284 | avoid interference of user settings. Thanks to Holger Mitschke for reporting 285 | this! 286 | 287 | 1.20 09-Feb-2015 288 | - Add :Uniq command. 289 | - Also support [/{pattern}/] [i][u][r][n][x][o] :sort argument order (and 290 | mixed). 291 | - FIX: Include missing Words.vim module that prevented the :SortWORDs command 292 | introduced in the previous version 1.10 from functioning. 293 | 294 | 1.10 23-Dec-2014 295 | - Add :SortWORDs command. 296 | 297 | 1.02 06-Nov-2014 298 | - BUG: :.SortRangesBy... doesn't work correctly on a closed fold; need to use 299 | ingo#range#NetStart(). 300 | *** You need to update to ingo-library (vimscript #4433) version 1.022! *** 301 | 302 | 1.01 10-Jul-2014 303 | - Make :SortRangesByRange work for Vim versions before 7.4.218 that don't have 304 | uniq(). 305 | *** You need to update to ingo-library (vimscript #4433) version 1.021! *** 306 | 307 | 1.00 11-Jun-2014 308 | First published version. 309 | 310 | 0.01 18-Jul-2012 311 | Started development. 312 | 313 | ============================================================================== 314 | Copyright: (C) 2012-2024 Ingo Karkat 315 | The VIM LICENSE applies to this plugin; see |copyright|. 316 | 317 | Maintainer: Ingo Karkat 318 | ============================================================================== 319 | vim:tw=78:ts=8:ft=help:norl: 320 | -------------------------------------------------------------------------------- /plugin/AdvancedSorters.vim: -------------------------------------------------------------------------------- 1 | " AdvancedSorters.vim: Sorting of certain areas or by special needs. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo-library.vim plugin 5 | " 6 | " Copyright: (C) 2014-2019 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | 11 | " Avoid installing twice or when in unsupported Vim version. 12 | if exists('g:loaded_AdvancedSorters') || (v:version < 700) 13 | finish 14 | endif 15 | let g:loaded_AdvancedSorters = 1 16 | let s:save_cpo = &cpo 17 | set cpo&vim 18 | 19 | command! -bang -range=% -nargs=* SortVisible 20 | \ call setline(, getline()) | 21 | \ if ! AdvancedSorters#Ranges#Visible('', , , ) | echoerr ingo#err#Get() | endif 22 | command! -bang -range=% -nargs=+ SortRangesByHeader 23 | \ call setline(, getline()) | 24 | \ if ! AdvancedSorters#Ranges#ByHeader('', , , ) | echoerr ingo#err#Get() | endif 25 | command! -bang -range=% -nargs=+ SortRangesByMatch 26 | \ call setline(, getline()) | 27 | \ if ! AdvancedSorters#Ranges#ByMatch('', , , ) | echoerr ingo#err#Get() | endif 28 | command! -bang -range=% -nargs=+ SortRangesByRange 29 | \ call setline(, getline()) | 30 | \ if ! AdvancedSorters#Ranges#ByRange('', , , ) | echoerr ingo#err#Get() | endif 31 | 32 | 33 | command! -range=% -nargs=+ ReorderVisible 34 | \ call setline(, getline()) | 35 | \ if ! AdvancedSorters#Reorder#Visible(, , ) | echoerr ingo#err#Get() | endif 36 | command! -range=% -nargs=+ ReorderFolded 37 | \ call setline(, getline()) | 38 | \ if ! AdvancedSorters#Reorder#Folded(, , ) | echoerr ingo#err#Get() | endif 39 | command! -range=% -nargs=+ ReorderUnfolded 40 | \ call setline(, getline()) | 41 | \ if ! AdvancedSorters#Reorder#Unfolded(, , ) | echoerr ingo#err#Get() | endif 42 | command! -range=% -nargs=+ ReorderByHeader 43 | \ call setline(, getline()) | 44 | \ if ! AdvancedSorters#Reorder#ByHeader(, , ) | echoerr ingo#err#Get() | endif 45 | command! -range=% -nargs=+ ReorderOnlyByMatch 46 | \ call setline(, getline()) | 47 | \ if ! AdvancedSorters#Reorder#OnlyByMatch(, , ) | echoerr ingo#err#Get() | endif 48 | command! -range=% -nargs=+ ReorderByMatchAndNonMatches 49 | \ call setline(, getline()) | 50 | \ if ! AdvancedSorters#Reorder#ByMatchAndNonMatches(, , ) | echoerr ingo#err#Get() | endif 51 | command! -range=% -nargs=+ ReorderByMatchAndLines 52 | \ call setline(, getline()) | 53 | \ if ! AdvancedSorters#Reorder#ByMatchAndLines(, , ) | echoerr ingo#err#Get() | endif 54 | command! -range=% -nargs=+ ReorderOnlyByRange 55 | \ call setline(, getline()) | 56 | \ if ! AdvancedSorters#Reorder#OnlyByRange(, , ) | echoerr ingo#err#Get() | endif 57 | command! -range=% -nargs=+ ReorderByRangeAndNonMatches 58 | \ call setline(, getline()) | 59 | \ if ! AdvancedSorters#Reorder#ByRangeAndNonMatches(, , ) | echoerr ingo#err#Get() | endif 60 | command! -range=% -nargs=+ ReorderByRangeAndLines 61 | \ call setline(, getline()) | 62 | \ if ! AdvancedSorters#Reorder#ByRangeAndLines(, , ) | echoerr ingo#err#Get() | endif 63 | 64 | 65 | command! -bang -range=% -nargs=1 -complete=expression SortByExpr 66 | \ call setline(, getline()) | 67 | \ if ! AdvancedSorters#Expr#Sort(, , 0, 0, ) | echoerr ingo#err#Get() | endif 68 | 69 | command! -bang -range=% -nargs=1 -complete=expression SortByExprUnique 70 | \ call setline(, getline()) | 71 | \ if ! AdvancedSorters#Expr#Sort(, , 0, 1, ) | echoerr ingo#err#Get() | endif 72 | 73 | command! -bang -range=% SortByCharLength 74 | \ call setline(, getline()) | 75 | \ if ! AdvancedSorters#Expr#Sort(, , 0, 0, function('ingo#compat#strchars')) | echoerr ingo#err#Get() | endif 76 | 77 | command! -bang -range=% SortByWidth 78 | \ call setline(, getline()) | 79 | \ if ! AdvancedSorters#Expr#Sort(, , 0, 0, function('ingo#compat#strdisplaywidth')) | echoerr ingo#err#Get() | endif 80 | 81 | command! -bang -range -nargs=* SortEach 82 | \ call setline(, getline()) | 83 | \ if ! AdvancedSorters#Each#Command('', , , ) | echoerr ingo#err#Get() | endif 84 | 85 | command! -bang -range -nargs=* SortWORDs 86 | \ call setline(, getline()) | 87 | \ if ! AdvancedSorters#Each#WORD('', , , ) | echoerr ingo#err#Get() | endif 88 | 89 | command! -range=% -nargs=* UniqAny 90 | \ call setline(, getline()) | 91 | \ if ! AdvancedSorters#Uniq#UniqAny(, , ) | echoerr ingo#err#Get() | endif 92 | command! -range=% -nargs=* UniqSubsequent 93 | \ call setline(, getline()) | 94 | \ if ! AdvancedSorters#Uniq#UniqSubsequent(, , ) | echoerr ingo#err#Get() | endif 95 | 96 | let &cpo = s:save_cpo 97 | unlet s:save_cpo 98 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 99 | -------------------------------------------------------------------------------- /tests/_setup.vim: -------------------------------------------------------------------------------- 1 | call vimtest#AddDependency('vim-ingo-library') 2 | 3 | runtime plugin/AdvancedSorters.vim 4 | -------------------------------------------------------------------------------- /tests/elements.txt: -------------------------------------------------------------------------------- 1 | foo-bar_baz-nono_mono-mix_lulli-quux 2 | quark-max__nox-foobar 3 | 4 | call IsPlacedMarks({ 5 | 'b': 14, 'a': 13, 'c': 14, 'z': 31, 'd': 90, 'g': 14, 'f': 93, 'x': 30, 'y': 32, 'k': 20, 'e': 91, 'j': 98 6 | }, 'reorder all lowercase marks') 7 | 8 | 'b': 14, 'a': 13, 'c': 14, 9 | 'z': 31, 'd': 90, 'C': 14, 10 | 'f': 93, 'x': 30, 'y': 32, 11 | 'k': 20, 'e': 91, 'j': 98 12 | 13 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments() 14 | 15 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments(), 16 | s:Inner(), s:JoinRanges(), s:ByHeader(), Sorters#Ranges#ByHeader(), 17 | s:OuterOne() 18 | -------------------------------------------------------------------------------- /tests/functions.txt: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/lengths.txt: -------------------------------------------------------------------------------- 1 | foobar is uux 2 | foobar is Quux 3 | foobar is ux 4 | for me it's clear! 5 | foooornication 6 | forlorn 7 | poor and sad 8 | fooxy bar 9 | foo bar 10 | fooxies bar 11 | foox bar 12 | la 13 | la 14 | la 15 | my default user 16 | my 日本語-user 17 | 123easy 18 | 42 niners 19 | 0s are gone 20 | -------------------------------------------------------------------------------- /tests/t1000-SortRangesByHeader.ok: -------------------------------------------------------------------------------- 1 | " Boilerplate 2 | " Code that is 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | 7 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 8 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 9 | " Public unrelated function 10 | endfunction 11 | 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Duplicate first line only 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:ByHeader( startLnum, endLnum, expr ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:ParseExpressionAndSortArguments( arguments ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 33 | " Internal 34 | " Stuff elided. 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1000-SortRangesByHeader.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by start of functions. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1010-SortRangesByHeader-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 2 | " Public unrelated function 3 | endfunction 4 | 5 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 6 | " Public function 7 | endfunction 8 | 9 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 10 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ParseExpressionAndSortArguments( arguments ) 15 | " Internal 16 | " Stuff elided. 17 | endfunction 18 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | function! s:ByHeader( startLnum, endLnum, expr ) 23 | " Internal 24 | " Stuff elided. 25 | endfunction 26 | function! s:ByHeader( startLnum, endLnum, expr ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Duplicate first line only 32 | " Stuff elided. 33 | endfunction 34 | " Code that is 35 | " Boilerplate 36 | -------------------------------------------------------------------------------- /tests/t1010-SortRangesByHeader-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test case-insensitive reverse sorting by start of functions. 2 | 3 | edit functions.txt 4 | SortRangesByHeader! /^function/i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1020-SortRangesByHeader-unique.ok: -------------------------------------------------------------------------------- 1 | " Boilerplate 2 | " Code that is 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | 7 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 8 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 9 | " Public unrelated function 10 | endfunction 11 | 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Duplicate first line only 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:ParseExpressionAndSortArguments( arguments ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | -------------------------------------------------------------------------------- /tests/t1020-SortRangesByHeader-unique.vim: -------------------------------------------------------------------------------- 1 | " Test sorting unique areas by start of functions. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function/u 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1030-SortRangesByHeader-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 4 | " Public unrelated function 5 | endfunction 6 | 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1030-SortRangesByHeader-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by start of functions within a range. 2 | 3 | edit functions.txt 4 | 3,26SortRangesByHeader /^function/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1040-SortRangesByHeader-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | 7 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 8 | function! s:ByHeader( startLnum, endLnum, expr ) 9 | " Duplicate first line only 10 | " Stuff elided. 11 | endfunction 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Internal 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:ParseExpressionAndSortArguments( arguments ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 33 | " Public unrelated function 34 | endfunction 35 | 36 | -------------------------------------------------------------------------------- /tests/t1040-SortRangesByHeader-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by actual function name. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function//^function! \%(s:\|\%(\w\+#\)*\)/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1045-SortRangesByHeader-sort-ipattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 28 | " Public unrelated function 29 | endfunction 30 | 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1045-SortRangesByHeader-sort-ipattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by actual function name. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function/ri/^function! \%(s:\u\l\+\|\w\+#\)/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1046-SortRangesByHeader-sort-ipattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 28 | " Public unrelated function 29 | endfunction 30 | 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1046-SortRangesByHeader-sort-ipattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by actual function name. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function//^function! \%(s:\u\l\+\|\w\+#\)/ri 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1047-SortRangesByHeader-sort-ipattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 28 | " Public unrelated function 29 | endfunction 30 | 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1047-SortRangesByHeader-sort-ipattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by actual function name. 2 | 3 | edit functions.txt 4 | SortRangesByHeader /^function/r/^function! \%(s:\u\l\+\|\w\+#\)/i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1050-SortRangesByHeader-no-headers.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1050-SortRangesByHeader-no-headers.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by start of nonexisting header. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('No headers found', 'SortRangesByHeader /^doesnotexist/', 'Error when there are no headers') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t1060-SortByHeader-formatoptions-j.ok: -------------------------------------------------------------------------------- 1 | function AName: 2 | let g:string = "Hello World" 3 | function BName: 4 | # simple 5 | # note 6 | let g:setting = 1 7 | -------------------------------------------------------------------------------- /tests/t1060-SortByHeader-formatoptions-j.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by start of functions with j in formatoptions. 2 | 3 | insert 4 | function BName: 5 | # simple 6 | # note 7 | let g:setting = 1 8 | function AName: 9 | let g:string = "Hello World" 10 | . 11 | 12 | setlocal formatoptions+=j comments=b:# 13 | SortRangesByHeader /^function/ 14 | 15 | call vimtest#SaveOut() 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /tests/t1100-SortRangesByMatch.ok: -------------------------------------------------------------------------------- 1 | 2 | 3 | " Boilerplate 4 | " Code that is 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 10 | " Public unrelated function 11 | endfunction 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Duplicate first line only 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:ByHeader( startLnum, endLnum, expr ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:ParseExpressionAndSortArguments( arguments ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 33 | " Internal 34 | " Stuff elided. 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1100-SortRangesByMatch.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by matched pattern. 2 | 3 | edit functions.txt 4 | SortRangesByMatch /^function\_.\{-}\nendfunction$/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1110-SortRangesByMatch-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 2 | " Public unrelated function 3 | endfunction 4 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 5 | " Public function 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Duplicate first line only 29 | " Stuff elided. 30 | endfunction 31 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 32 | " Code that is 33 | " Boilerplate 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/t1110-SortRangesByMatch-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test case-insensitive reverse sorting by matched pattern. 2 | 3 | edit functions.txt 4 | SortRangesByMatch! /^function\_.\{-}\nendfunction$/i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1120-SortRangesByMatch-unique.ok: -------------------------------------------------------------------------------- 1 | 2 | " Boilerplate 3 | " Code that is 4 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 5 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 6 | " Public function 7 | endfunction 8 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 9 | " Public unrelated function 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Duplicate first line only 13 | " Stuff elided. 14 | endfunction 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ParseExpressionAndSortArguments( arguments ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | -------------------------------------------------------------------------------- /tests/t1120-SortRangesByMatch-unique.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by matched pattern. 2 | 3 | edit functions.txt 4 | SortRangesByMatch /^function\_.\{-}\nendfunction$/u 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1130-SortRangesByMatch-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 5 | " Public unrelated function 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1130-SortRangesByMatch-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by matched pattern within a range. 2 | 3 | edit functions.txt 4 | 3,26SortRangesByMatch /^function\_.\{-}\nendfunction$/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1140-SortRangesByMatch-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | " Duplicate first line only 11 | " Stuff elided. 12 | endfunction 13 | function! s:ByHeader( startLnum, endLnum, expr ) 14 | " Internal 15 | " Stuff elided. 16 | endfunction 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | " Internal 19 | " Stuff elided. 20 | endfunction 21 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 22 | " Internal 23 | " Stuff elided. 24 | endfunction 25 | function! s:ParseExpressionAndSortArguments( arguments ) 26 | " Internal 27 | " Stuff elided. 28 | endfunction 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | " Internal 31 | " Stuff elided. 32 | endfunction 33 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 34 | " Public unrelated function 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1140-SortRangesByMatch-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by matched pattern by actual function name. 2 | 3 | edit functions.txt 4 | SortRangesByMatch /^function\_.\{-}\nendfunction$//^function! \%(s:\|\%(\w\+#\)*\)/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1150-SortRangesByMatch-no-matches.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1150-SortRangesByMatch-no-matches.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by nonexisting matches. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('No matches found', 'SortRangesByMatch /^function\_.\{-}\ndoesnotexist$/', 'Error when there are no matches') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t1200-SortRangesByRange.ok: -------------------------------------------------------------------------------- 1 | 2 | 3 | " Boilerplate 4 | " Code that is 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 10 | " Public unrelated function 11 | endfunction 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Duplicate first line only 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:ByHeader( startLnum, endLnum, expr ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:ParseExpressionAndSortArguments( arguments ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 33 | " Internal 34 | " Stuff elided. 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1200-SortRangesByRange.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range. 2 | 3 | edit functions.txt 4 | SortRangesByRange /^function/,/^endfunction$/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1210-SortRangesByRange-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 2 | " Public unrelated function 3 | endfunction 4 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 5 | " Public function 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Duplicate first line only 29 | " Stuff elided. 30 | endfunction 31 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 32 | " Code that is 33 | " Boilerplate 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/t1210-SortRangesByRange-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test case-insensitive reverse sorting by range. 2 | 3 | edit functions.txt 4 | SortRangesByRange! /^function/,/^endfunction$/i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1220-SortRangesByRange-unique.ok: -------------------------------------------------------------------------------- 1 | 2 | " Boilerplate 3 | " Code that is 4 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 5 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 6 | " Public function 7 | endfunction 8 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 9 | " Public unrelated function 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Duplicate first line only 13 | " Stuff elided. 14 | endfunction 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ParseExpressionAndSortArguments( arguments ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | -------------------------------------------------------------------------------- /tests/t1220-SortRangesByRange-unique.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by range. 2 | 3 | edit functions.txt 4 | SortRangesByRange /^function/,/^endfunction$/u 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1230-SortRangesByRange-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 5 | " Public unrelated function 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1230-SortRangesByRange-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range within a range. 2 | 3 | edit functions.txt 4 | 3,26SortRangesByRange /^function/,/^endfunction$/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1235-SortRangesByRange-fold.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 5 | " Public unrelated function 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1235-SortRangesByRange-fold.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range within a fold. 2 | 3 | edit functions.txt 4 | 3,26fold 5 | 3SortRangesByRange /^function/,/^endfunction$/ 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t1240-SortRangesByRange-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | " Duplicate first line only 11 | " Stuff elided. 12 | endfunction 13 | function! s:ByHeader( startLnum, endLnum, expr ) 14 | " Internal 15 | " Stuff elided. 16 | endfunction 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | " Internal 19 | " Stuff elided. 20 | endfunction 21 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 22 | " Internal 23 | " Stuff elided. 24 | endfunction 25 | function! s:ParseExpressionAndSortArguments( arguments ) 26 | " Internal 27 | " Stuff elided. 28 | endfunction 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | " Internal 31 | " Stuff elided. 32 | endfunction 33 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 34 | " Public unrelated function 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1240-SortRangesByRange-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range by actual function name with intermediate flag. 2 | 3 | edit functions.txt 4 | SortRangesByRange /^function/,/^endfunction$/i/^function! \%(s:\|\%(\w\+#\)*\)/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1241-SortRangesByRange-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | " Duplicate first line only 11 | " Stuff elided. 12 | endfunction 13 | function! s:ByHeader( startLnum, endLnum, expr ) 14 | " Internal 15 | " Stuff elided. 16 | endfunction 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | " Internal 19 | " Stuff elided. 20 | endfunction 21 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 22 | " Internal 23 | " Stuff elided. 24 | endfunction 25 | function! s:ParseExpressionAndSortArguments( arguments ) 26 | " Internal 27 | " Stuff elided. 28 | endfunction 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | " Internal 31 | " Stuff elided. 32 | endfunction 33 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 34 | " Public unrelated function 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1241-SortRangesByRange-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range by actual function name with different delimiter. 2 | 3 | edit functions.txt 4 | SortRangesByRange /^function/,/^endfunction$/ @^function! \%(s:\|\%(\w\+#\)*\)@ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1242-SortRangesByRange-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | " Duplicate first line only 11 | " Stuff elided. 12 | endfunction 13 | function! s:ByHeader( startLnum, endLnum, expr ) 14 | " Internal 15 | " Stuff elided. 16 | endfunction 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | " Internal 19 | " Stuff elided. 20 | endfunction 21 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 22 | " Internal 23 | " Stuff elided. 24 | endfunction 25 | function! s:ParseExpressionAndSortArguments( arguments ) 26 | " Internal 27 | " Stuff elided. 28 | endfunction 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | " Internal 31 | " Stuff elided. 32 | endfunction 33 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 34 | " Public unrelated function 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t1242-SortRangesByRange-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by range by actual function name with same delimiter. 2 | 3 | edit functions.txt 4 | SortRangesByRange /^function/,/^endfunction$/ /^function! \%(s:\|\%(\w\+#\)*\)/ 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t1250-SortRangesByRange-no-ranges.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t1250-SortRangesByRange-no-ranges.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by nonexisting ranges. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('No ranges found', 'SortRangesByRange /^function/,/^doesnotexist$/', 'Error when there are no ranges') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t1260-SortRangesByRange-between-marks.ok: -------------------------------------------------------------------------------- 1 | 2 | 3 | " Duplicate first line only 4 | " Internal 5 | " Internal 6 | " Internal 7 | " Public function 8 | " Stuff elided. 9 | " Stuff elided. 10 | " Stuff elided. 11 | " Stuff elided. 12 | " Boilerplate 13 | " Code that is 14 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 15 | endfunction 16 | endfunction 17 | endfunction 18 | endfunction 19 | endfunction 20 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 21 | function! s:ByHeader( startLnum, endLnum, expr ) 22 | function! s:ByHeader( startLnum, endLnum, expr ) 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 32 | " Public unrelated function 33 | endfunction 34 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 35 | function! s:ParseExpressionAndSortArguments( arguments ) 36 | -------------------------------------------------------------------------------- /tests/t1260-SortRangesByRange-between-marks.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by a range defined by two marks. 2 | 3 | edit functions.txt 4 | 3mark a 5 | 13mark b 6 | SortRangesByRange 'a,'b 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t2000-SortVisible.ok: -------------------------------------------------------------------------------- 1 | 2 | 3 | " Boilerplate 4 | " Code that is 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 10 | " Public unrelated function 11 | endfunction 12 | function! s:ByHeader( startLnum, endLnum, expr ) 13 | " Duplicate first line only 14 | " Stuff elided. 15 | endfunction 16 | function! s:ByHeader( startLnum, endLnum, expr ) 17 | " Internal 18 | " Stuff elided. 19 | endfunction 20 | function! s:ByHeader( startLnum, endLnum, expr ) 21 | " Internal 22 | " Stuff elided. 23 | endfunction 24 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 25 | " Internal 26 | " Stuff elided. 27 | endfunction 28 | function! s:ParseExpressionAndSortArguments( arguments ) 29 | " Internal 30 | " Stuff elided. 31 | endfunction 32 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 33 | " Internal 34 | " Stuff elided. 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t2000-SortVisible.vim: -------------------------------------------------------------------------------- 1 | " Test sorting visible lines. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | SortVisible 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2010-SortVisible-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 2 | " Public unrelated function 3 | endfunction 4 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 5 | " Public function 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Duplicate first line only 29 | " Stuff elided. 30 | endfunction 31 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 32 | " Code that is 33 | " Boilerplate 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/t2010-SortVisible-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test case-insensitive reverse sorting of visible lines. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | SortVisible! i 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2020-SortVisible-unique.ok: -------------------------------------------------------------------------------- 1 | 2 | " Boilerplate 3 | " Code that is 4 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 5 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 6 | " Public function 7 | endfunction 8 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 9 | " Public unrelated function 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Duplicate first line only 13 | " Stuff elided. 14 | endfunction 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ParseExpressionAndSortArguments( arguments ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | -------------------------------------------------------------------------------- /tests/t2020-SortVisible-unique.vim: -------------------------------------------------------------------------------- 1 | " Test sorting unique visible lines. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | SortVisible u 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2030-SortVisible-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 5 | " Public unrelated function 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t2030-SortVisible-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting visible lines within a range. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | 3,26SortVisible 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2035-SortVisible-fold.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 5 | " Public unrelated function 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ByHeader( startLnum, endLnum, expr ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t2035-SortVisible-fold.vim: -------------------------------------------------------------------------------- 1 | " Test sorting visible lines within a fold. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | 3,23SortVisible 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2040-SortVisible-sort-pattern.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 7 | " Public function 8 | endfunction 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | " Duplicate first line only 11 | " Stuff elided. 12 | endfunction 13 | function! s:ByHeader( startLnum, endLnum, expr ) 14 | " Internal 15 | " Stuff elided. 16 | endfunction 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | " Internal 19 | " Stuff elided. 20 | endfunction 21 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 22 | " Internal 23 | " Stuff elided. 24 | endfunction 25 | function! s:ParseExpressionAndSortArguments( arguments ) 26 | " Internal 27 | " Stuff elided. 28 | endfunction 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | " Internal 31 | " Stuff elided. 32 | endfunction 33 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 34 | " Public unrelated function 35 | endfunction 36 | -------------------------------------------------------------------------------- /tests/t2040-SortVisible-sort-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting visible lines by actual function name.. 2 | 3 | edit functions.txt 4 | g/^function/,/^endfunction/fold 5 | SortVisible /^function! \%(s:\|\%(\w\+#\)*\)/ 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t2050-SortVisible-no-folds.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t2050-SortVisible-no-folds.vim: -------------------------------------------------------------------------------- 1 | " Test sorting all lines, without folding. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('No folds found', 'SortVisible', 'Error when there are no folds') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t2055-SortVisible-oneline-folds.ok: -------------------------------------------------------------------------------- 1 | 2 | 3 | " Duplicate first line only 4 | " Internal 5 | " Internal 6 | " Internal 7 | " Internal 8 | " Internal 9 | " Public function 10 | " Public unrelated function 11 | " Stuff elided. 12 | " Stuff elided. 13 | " Stuff elided. 14 | " Stuff elided. 15 | " Stuff elided. 16 | " Stuff elided. 17 | " Boilerplate 18 | " Code that is 19 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 20 | endfunction 21 | endfunction 22 | endfunction 23 | endfunction 24 | endfunction 25 | endfunction 26 | endfunction 27 | endfunction 28 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 29 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | function! s:ByHeader( startLnum, endLnum, expr ) 32 | function! s:ByHeader( startLnum, endLnum, expr ) 33 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 34 | function! s:ParseExpressionAndSortArguments( arguments ) 35 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 36 | -------------------------------------------------------------------------------- /tests/t2055-SortVisible-oneline-folds.vim: -------------------------------------------------------------------------------- 1 | " Test sorting all individually folded lines. 2 | 3 | edit functions.txt 4 | 5 | " One-line folds are only shown when the text exceeds the window width. To avoid 6 | " depending on the terminal size, obtain a fixed window width via a vertical 7 | " split. 8 | 20vsplit 9 | 10 | g/^/fold 11 | SortVisible 12 | 13 | call vimtest#SaveOut() 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /tests/t2060-SortVisible-formatoptions-j.ok: -------------------------------------------------------------------------------- 1 | " AName: {{{1 2 | let g:string = "Hello World" 3 | " BName: {{{1 4 | " note 5 | let g:setting = 1 6 | -------------------------------------------------------------------------------- /tests/t2060-SortVisible-formatoptions-j.vim: -------------------------------------------------------------------------------- 1 | " Test sorting visible lines with j in formatoptions. 2 | 3 | insert 4 | " BName: {{{1 5 | " note 6 | let g:setting = 1 7 | " AName: {{{1 8 | let g:string = "Hello World" 9 | . 10 | 11 | setlocal foldmethod=marker formatoptions+=j comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" 12 | SortVisible 13 | 14 | call vimtest#SaveOut() 15 | call vimtest#Quit() 16 | -------------------------------------------------------------------------------- /tests/t3000-SortByExpr.ok: -------------------------------------------------------------------------------- 1 | la 2 | la 3 | la 4 | for me it's clear! 5 | forlorn 6 | foobar is uux 7 | foobar is Quux 8 | foobar is ux 9 | foooornication 10 | poor and sad 11 | foo bar 12 | foox bar 13 | fooxy bar 14 | fooxies bar 15 | my default user 16 | my 日本語-user 17 | 0s are gone 18 | 123easy 19 | 42 niners 20 | -------------------------------------------------------------------------------- /tests/t3000-SortByExpr.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by a fixed order expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | let g:ordering = [6, 7, 8, 4, 9, 5, 10, 13, 11, 14, 12, 3, 1, 2, 15, 16, 18, 19, 17, 99] 9 | call vimtap#Is(line('$') + 1, len(g:ordering), 'expression is initialized with one value for each line, and sentinel') 10 | 11 | SortByExpr remove(g:ordering, 0) 12 | 13 | call vimtap#Is(g:ordering, [99], 'expression has been evaluated once for each line') 14 | 15 | call vimtest#SaveOut() 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /tests/t3010-SortByExpr-reverse.ok: -------------------------------------------------------------------------------- 1 | 42 niners 2 | 123easy 3 | 0s are gone 4 | my 日本語-user 5 | my default user 6 | fooxies bar 7 | fooxy bar 8 | foox bar 9 | foo bar 10 | poor and sad 11 | foooornication 12 | foobar is ux 13 | foobar is Quux 14 | foobar is uux 15 | forlorn 16 | for me it's clear! 17 | la 18 | la 19 | la 20 | -------------------------------------------------------------------------------- /tests/t3010-SortByExpr-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse sorting by a fixed order expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | let g:ordering = [6, 7, 8, 4, 9, 5, 10, 13, 11, 14, 12, 3, 1, 2, 15, 16, 18, 19, 17, 99] 9 | call vimtap#Is(line('$') + 1, len(g:ordering), 'expression is initialized with one value for each line, and sentinel') 10 | 11 | SortByExpr! remove(g:ordering, 0) 12 | 13 | call vimtap#Is(g:ordering, [99], 'expression has been evaluated once for each line') 14 | 15 | call vimtest#SaveOut() 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /tests/t3020-SortByExpr-constant.ok: -------------------------------------------------------------------------------- 1 | foobar is uux 2 | foobar is Quux 3 | foobar is ux 4 | for me it's clear! 5 | foooornication 6 | forlorn 7 | poor and sad 8 | fooxy bar 9 | foo bar 10 | fooxies bar 11 | foox bar 12 | la 13 | la 14 | la 15 | my default user 16 | my 日本語-user 17 | 123easy 18 | 42 niners 19 | 0s are gone 20 | -------------------------------------------------------------------------------- /tests/t3020-SortByExpr-constant.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by a constant expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExpr 1 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3025-SortByExpr-constant-reverse.ok: -------------------------------------------------------------------------------- 1 | 0s are gone 2 | 42 niners 3 | 123easy 4 | my 日本語-user 5 | my default user 6 | la 7 | la 8 | la 9 | foox bar 10 | fooxies bar 11 | foo bar 12 | fooxy bar 13 | poor and sad 14 | forlorn 15 | foooornication 16 | for me it's clear! 17 | foobar is ux 18 | foobar is Quux 19 | foobar is uux 20 | -------------------------------------------------------------------------------- /tests/t3025-SortByExpr-constant-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse sorting by a constant expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExpr! 1 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3030-SortByExpr-val.ok: -------------------------------------------------------------------------------- 1 | la 2 | la 3 | la 4 | my default user 5 | my 日本語-user 6 | 123easy 7 | 42 niners 8 | for me it's clear! 9 | 0s are gone 10 | foobar is uux 11 | foobar is Quux 12 | foobar is ux 13 | forlorn 14 | poor and sad 15 | fooxy bar 16 | foo bar 17 | fooxies bar 18 | foox bar 19 | foooornication 20 | -------------------------------------------------------------------------------- /tests/t3030-SortByExpr-val.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by a expression that uses v:val. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExpr len(substitute(v:val, '[^o]', '', 'g')) 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3040-SortByExpr-range.ok: -------------------------------------------------------------------------------- 1 | foobar is uux 2 | foobar is Quux 3 | for me it's clear! 4 | foobar is ux 5 | forlorn 6 | poor and sad 7 | fooxy bar 8 | foooornication 9 | foo bar 10 | fooxies bar 11 | foox bar 12 | la 13 | la 14 | la 15 | my default user 16 | my 日本語-user 17 | 123easy 18 | 42 niners 19 | 0s are gone 20 | -------------------------------------------------------------------------------- /tests/t3040-SortByExpr-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting a range by a expression that uses v:val. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | 3,8SortByExpr len(substitute(v:val, '[^o]', '', 'g')) 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3100-SortByCharLength.ok: -------------------------------------------------------------------------------- 1 | la 2 | la 3 | forlorn 4 | foo bar 5 | 123easy 6 | foox bar 7 | la 8 | fooxy bar 9 | 42 niners 10 | fooxies bar 11 | my 日本語-user 12 | 0s are gone 13 | poor and sad 14 | foobar is ux 15 | foobar is uux 16 | foobar is Quux 17 | foooornication 18 | my default user 19 | for me it's clear! 20 | -------------------------------------------------------------------------------- /tests/t3100-SortByCharLength.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by number of characters. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByCharLength 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3110-SortByCharLength-reverse.ok: -------------------------------------------------------------------------------- 1 | for me it's clear! 2 | my default user 3 | foooornication 4 | foobar is Quux 5 | foobar is uux 6 | foobar is ux 7 | poor and sad 8 | 0s are gone 9 | my 日本語-user 10 | fooxies bar 11 | 42 niners 12 | fooxy bar 13 | la 14 | foox bar 15 | 123easy 16 | foo bar 17 | forlorn 18 | la 19 | la 20 | -------------------------------------------------------------------------------- /tests/t3110-SortByCharLength-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse sorting by number of characters. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByCharLength! 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3200-SortByWidth.ok: -------------------------------------------------------------------------------- 1 | forlorn 2 | 123easy 3 | 42 niners 4 | fooxy bar 5 | foo bar 6 | fooxies bar 7 | foox bar 8 | 0s are gone 9 | poor and sad 10 | foobar is Quux 11 | foobar is ux 12 | foooornication 13 | my 日本語-user 14 | foobar is uux 15 | my default user 16 | for me it's clear! 17 | la 18 | la 19 | la 20 | -------------------------------------------------------------------------------- /tests/t3200-SortByWidth.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by display width. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByWidth 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3210-SortByWidth-reverse.ok: -------------------------------------------------------------------------------- 1 | la 2 | la 3 | la 4 | for me it's clear! 5 | my default user 6 | foobar is uux 7 | my 日本語-user 8 | foooornication 9 | foobar is ux 10 | foobar is Quux 11 | poor and sad 12 | 0s are gone 13 | foox bar 14 | fooxies bar 15 | foo bar 16 | fooxy bar 17 | 42 niners 18 | 123easy 19 | forlorn 20 | -------------------------------------------------------------------------------- /tests/t3210-SortByWidth-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse sorting by display width. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByWidth! 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3300-SortByExprUnique.ok: -------------------------------------------------------------------------------- 1 | la 2 | for me it's clear! 3 | forlorn 4 | foobar is uux 5 | foooornication 6 | poor and sad 7 | foo bar 8 | foox bar 9 | fooxy bar 10 | fooxies bar 11 | my default user 12 | 0s are gone 13 | 123easy 14 | 42 niners 15 | -------------------------------------------------------------------------------- /tests/t3300-SortByExprUnique.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by a fixed order expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | let g:ordering = [6, 6, 6, 4, 9, 5, 10, 13, 11, 14, 12, 2, 2, 2, 15, 15, 18, 19, 17, 99] 9 | call vimtap#Is(line('$') + 1, len(g:ordering), 'expression is initialized with one value for each line, and sentinel') 10 | 11 | SortByExprUnique remove(g:ordering, 0) 12 | 13 | call vimtap#Is(g:ordering, [99], 'expression has been evaluated once for each line') 14 | 15 | call vimtest#SaveOut() 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /tests/t3310-SortByExprUnique-reverse.ok: -------------------------------------------------------------------------------- 1 | 42 niners 2 | 123easy 3 | 0s are gone 4 | my 日本語-user 5 | fooxies bar 6 | fooxy bar 7 | foox bar 8 | foo bar 9 | poor and sad 10 | foooornication 11 | foobar is ux 12 | forlorn 13 | for me it's clear! 14 | la 15 | -------------------------------------------------------------------------------- /tests/t3310-SortByExprUnique-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse unique sorting by a fixed order expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | let g:ordering = [6, 6, 6, 4, 9, 5, 10, 13, 11, 14, 12, 2, 2, 2, 15, 15, 18, 19, 17, 99] 9 | call vimtap#Is(line('$') + 1, len(g:ordering), 'expression is initialized with one value for each line, and sentinel') 10 | 11 | SortByExprUnique! remove(g:ordering, 0) 12 | 13 | call vimtap#Is(g:ordering, [99], 'expression has been evaluated once for each line') 14 | 15 | call vimtest#SaveOut() 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /tests/t3320-SortByExprUnique-constant.ok: -------------------------------------------------------------------------------- 1 | foobar is uux 2 | -------------------------------------------------------------------------------- /tests/t3320-SortByExprUnique-constant.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by a constant expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExprUnique 1 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3325-SortByExprUnique-constant-reverse.ok: -------------------------------------------------------------------------------- 1 | 0s are gone 2 | -------------------------------------------------------------------------------- /tests/t3325-SortByExprUnique-constant-reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse unique sorting by a constant expression. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExprUnique! 1 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3330-SortByExprUnique-val.ok: -------------------------------------------------------------------------------- 1 | la 2 | for me it's clear! 3 | foobar is uux 4 | foooornication 5 | -------------------------------------------------------------------------------- /tests/t3330-SortByExprUnique-val.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by a expression that uses v:val. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | SortByExprUnique len(substitute(v:val, '[^o]', '', 'g')) 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3340-SortByExprUnique-range.ok: -------------------------------------------------------------------------------- 1 | foobar is uux 2 | foobar is Quux 3 | for me it's clear! 4 | foobar is ux 5 | foooornication 6 | foo bar 7 | fooxies bar 8 | foox bar 9 | la 10 | la 11 | la 12 | my default user 13 | my 日本語-user 14 | 123easy 15 | 42 niners 16 | 0s are gone 17 | -------------------------------------------------------------------------------- /tests/t3340-SortByExprUnique-range.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting a range by a expression that uses v:val. 2 | 3 | set encoding=utf-8 4 | edit ++enc=utf-8 lengths.txt 5 | 6 | 3,8SortByExprUnique len(substitute(v:val, '[^o]', '', 'g')) 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t3350-SortByExprUnique-no-duplicates.ok: -------------------------------------------------------------------------------- 1 | la 2 | la 3 | la 4 | for me it's clear! 5 | forlorn 6 | foobar is uux 7 | foobar is Quux 8 | foobar is ux 9 | foooornication 10 | poor and sad 11 | foo bar 12 | foox bar 13 | fooxy bar 14 | fooxies bar 15 | my default user 16 | my 日本語-user 17 | 0s are gone 18 | 123easy 19 | 42 niners 20 | -------------------------------------------------------------------------------- /tests/t3350-SortByExprUnique-no-duplicates.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by a fixed order expression that doesn't yield duplicates. 2 | " Tests that the result is the same as with :SortByExpr. 3 | 4 | set encoding=utf-8 5 | edit ++enc=utf-8 lengths.txt 6 | 7 | call vimtest#StartTap() 8 | call vimtap#Plan(2) 9 | let g:ordering = [6, 7, 8, 4, 9, 5, 10, 13, 11, 14, 12, 3, 1, 2, 15, 16, 18, 19, 17, 99] 10 | call vimtap#Is(line('$') + 1, len(g:ordering), 'expression is initialized with one value for each line, and sentinel') 11 | 12 | SortByExprUnique remove(g:ordering, 0) 13 | 14 | call vimtap#Is(g:ordering, [99], 'expression has been evaluated once for each line') 15 | 16 | call vimtest#SaveOut() 17 | call vimtest#Quit() 18 | -------------------------------------------------------------------------------- /tests/t4000-SortWORDs-line.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | a b c d e f 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | 9 | s:ByHeader() 10 | 11 | s:SortRanges() 12 | Sorters#Ranges#Unfolded() 13 | s:ParseExpressionAndSortArguments() 14 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 15 | s:InnerOne() 16 | -------------------------------------------------------------------------------- /tests/t4000-SortWORDs-line.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by words. 2 | 3 | edit words.txt 4 | 5 | 2SortWORDs 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4010-SortWORDs-range.ok: -------------------------------------------------------------------------------- 1 | a b c d e f u v w x y z 2 | 3 | 4 | " Code that is 5 | " Boilerplate 6 | 7 | 8 | s:ByHeader() 9 | 10 | s:SortRanges() 11 | Sorters#Ranges#Unfolded() 12 | s:ParseExpressionAndSortArguments() 13 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 14 | s:InnerOne() 15 | -------------------------------------------------------------------------------- /tests/t4010-SortWORDs-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by words in a range. 2 | 3 | edit words.txt 4 | 5 | 1,2SortWORDs 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4020-SortWORDs-multiple-whitespace.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | Sorters#Ranges#ByHeader() Sorters#Ranges#Unfolded() s:ByHeader() s:ByHeader() s:ByHeader() s:InnerOne() s:JoinRanges() s:ParseExpressionAndSortArguments() s:SortRanges() 9 | -------------------------------------------------------------------------------- /tests/t4020-SortWORDs-multiple-whitespace.vim: -------------------------------------------------------------------------------- 1 | " Test how multiple whitespace is condensed. 2 | 3 | edit words.txt 4 | 5 | 8,$SortWORDs 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4030-SortWORDs-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | Sorters#Ranges#Unfolded() Sorters#Ranges#ByHeader() s:SortRanges() s:ParseExpressionAndSortArguments() s:JoinRanges() s:InnerOne() s:ByHeader() s:ByHeader() s:ByHeader() 9 | -------------------------------------------------------------------------------- /tests/t4030-SortWORDs-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse, icase sorting by words. 2 | 3 | edit words.txt 4 | 5 | 8,$SortWORDs! i 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4040-SortWORDs-unique.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | Sorters#Ranges#ByHeader() Sorters#Ranges#Unfolded() s:ByHeader() s:InnerOne() s:JoinRanges() s:ParseExpressionAndSortArguments() s:SortRanges() 9 | -------------------------------------------------------------------------------- /tests/t4040-SortWORDs-unique.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by words. 2 | 3 | edit words.txt 4 | 5 | 8,$SortWORDs u 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4050-SortWORDs-pattern.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | s:ByHeader() s:ByHeader() s:ByHeader() Sorters#Ranges#ByHeader() s:InnerOne() s:JoinRanges() s:ParseExpressionAndSortArguments() s:SortRanges() Sorters#Ranges#Unfolded() 9 | -------------------------------------------------------------------------------- /tests/t4050-SortWORDs-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting with skipped pattern. 2 | 3 | edit words.txt 4 | 5 | 8,$SortWORDs /s:\|.\+#/ 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4100-SortWORDs-single-word.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | 9 | s:ByHeader() 10 | 11 | s:SortRanges() 12 | Sorters#Ranges#Unfolded() 13 | s:ParseExpressionAndSortArguments() 14 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 15 | s:InnerOne() 16 | -------------------------------------------------------------------------------- /tests/t4100-SortWORDs-single-word.vim: -------------------------------------------------------------------------------- 1 | " Test sorting a single word. 2 | 3 | edit words.txt 4 | 5 | 9SortWORDs 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t4110-SortWORDs-no-word.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | 9 | s:ByHeader() 10 | 11 | s:SortRanges() 12 | Sorters#Ranges#Unfolded() 13 | s:ParseExpressionAndSortArguments() 14 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 15 | s:InnerOne() 16 | -------------------------------------------------------------------------------- /tests/t4110-SortWORDs-no-word.vim: -------------------------------------------------------------------------------- 1 | " Test sorting not a single word. 2 | 3 | edit words.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('No WORDs to sort', '8SortWORDs', 'error when on whitespace-only line') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4120-SortWORDs-invalid-args.ok: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | 9 | s:ByHeader() 10 | 11 | s:SortRanges() 12 | Sorters#Ranges#Unfolded() 13 | s:ParseExpressionAndSortArguments() 14 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 15 | s:InnerOne() 16 | -------------------------------------------------------------------------------- /tests/t4120-SortWORDs-invalid-args.vim: -------------------------------------------------------------------------------- 1 | " Test passing invalid sort arguments. 2 | 3 | edit words.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('E475: Invalid argument: doesnotexist', '2SortWORDs doesnotexist', 'Error when passing invalid sort arguments') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4200-SortEach-line.ok: -------------------------------------------------------------------------------- 1 | baz-nono_foo-bar_lulli-quux_mono-mix 2 | quark-max__nox-foobar 3 | 4 | call IsPlacedMarks({ 5 | 'a': 13, 'b': 14, 'c': 14, 'd': 90, 'e': 91, 'f': 93, 'g': 14, 'j': 98, 'k': 20, 'x': 30, 'y': 32, 'z': 31 6 | }, 'reorder all lowercase marks') 7 | 8 | 'b': 14, 'a': 13, 'c': 14, 9 | 'z': 31, 'd': 90, 'C': 14, 10 | 'f': 93, 'x': 30, 'y': 32, 11 | 'k': 20, 'e': 91, 'j': 98 12 | 13 | Sorters#Ranges#Unfolded() s:ByHeader() s:ParseExpressionAndSortArguments() s:SortRanges() 14 | 15 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments(), 16 | s:Inner(), s:JoinRanges(), s:ByHeader(), Sorters#Ranges#ByHeader(), 17 | s:OuterOne() 18 | -------------------------------------------------------------------------------- /tests/t4200-SortEach-line.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by elements. 2 | 3 | edit elements.txt 4 | 5 | 13SortEach /,\s\+/ / 6 | 5SortEach /, /, / 7 | 1SortEach /_/_/ 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4210-SortEach-range.ok: -------------------------------------------------------------------------------- 1 | bar_baz_foo_foobar_lulli_max_mix_mono_nono_nox_quark_quux 2 | 3 | call IsPlacedMarks({ 4 | 'b': 14, 'a': 13, 'c': 14, 'z': 31, 'd': 90, 'g': 14, 'f': 93, 'x': 30, 'y': 32, 'k': 20, 'e': 91, 'j': 98 5 | }, 'reorder all lowercase marks') 6 | 7 | 'C': 14, 'a': 13, 'b': 14, 'c': 14, 'd': 90, 'e': 91, 'f': 93, 'j': 98, 'k': 20, 'x': 30, 'y': 32, 'z': 31 8 | 9 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments() 10 | 11 | Sorters#Ranges#ByHeader() Sorters#Ranges#Unfolded() s:ByHeader() s:ByHeader() s:Inner() s:JoinRanges() s:OuterOne() s:ParseExpressionAndSortArguments() s:SortRanges() 12 | -------------------------------------------------------------------------------- /tests/t4210-SortEach-range.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by elements in a range. 2 | 3 | edit elements.txt 4 | 5 | 15,17SortEach /^\s\+\|,\_s*/ / 6 | 8,11SortEach /,\s*\|,\n/, / 7 | 1,2SortEach /[-_]/_/ 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4220-SortEach-first-separator.ok: -------------------------------------------------------------------------------- 1 | bar-baz-foo-foobar-lulli-max-mix-mono-nono-nox-quark-quux 2 | 3 | call IsPlacedMarks({ 4 | 'b': 14, 'a': 13, 'c': 14, 'z': 31, 'd': 90, 'g': 14, 'f': 93, 'x': 30, 'y': 32, 'k': 20, 'e': 91, 'j': 98 5 | }, 'reorder all lowercase marks') 6 | 7 | 'C': 14, 'a': 13, 'b': 14, 'c': 14, 'd': 90, 'e': 91, 'f': 93, 'j': 98, 'k': 20, 'x': 30, 'y': 32, 'z': 31 8 | 9 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments() 10 | 11 | Sorters#Ranges#ByHeader() Sorters#Ranges#Unfolded() s:ByHeader() s:ByHeader() s:Inner() s:JoinRanges() s:OuterOne() s:ParseExpressionAndSortArguments() s:SortRanges() 12 | -------------------------------------------------------------------------------- /tests/t4220-SortEach-first-separator.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by elements, joining with the first found separator. 2 | 3 | edit elements.txt 4 | 5 | 15,17SortEach /^\s\+\|,\_s*/ 6 | 8,11SortEach /,\s*\|,\n/ 7 | 1,2SortEach /[-_]/ 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4230-SortEach-icase,reverse.ok: -------------------------------------------------------------------------------- 1 | quux_quark_nox_nono_mono_mix_max_lulli_foobar_foo_baz_bar 2 | 3 | call IsPlacedMarks({ 4 | 'a': 13, 'b': 14, 'c': 14, 'g': 14, 'k': 20, 'x': 30, 'z': 31, 'y': 32, 'd': 90, 'e': 91, 'f': 93, 'j': 98 5 | }, 'reorder all lowercase marks') 6 | 7 | 'z': 31, 'y': 32, 'x': 30, 'k': 20, 'j': 98, 'f': 93, 'e': 91, 'd': 90, 'C': 14, 'c': 14, 'b': 14, 'a': 13 8 | 9 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments() 10 | 11 | Sorters#Ranges#Unfolded() Sorters#Ranges#ByHeader() s:SortRanges() s:ParseExpressionAndSortArguments() s:OuterOne() s:JoinRanges() s:Inner() s:ByHeader() s:ByHeader() 12 | -------------------------------------------------------------------------------- /tests/t4230-SortEach-icase,reverse.vim: -------------------------------------------------------------------------------- 1 | " Test reverse, icase, numeric sorting by elements. 2 | 3 | edit elements.txt 4 | 5 | 15,17SortEach! /^\s\+\|,\_s*/ / i 6 | 8,11SortEach! /,\s*\|,\n/, / i 7 | 5SortEach /,\s*\|,\n/, / n 8 | 1,2SortEach! /[-_]/_/ i 9 | 10 | call vimtest#SaveOut() 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /tests/t4240-SortEach-unique.ok: -------------------------------------------------------------------------------- 1 | bar!baz!foo!foobar!lulli!max!mix!mono!nono!nox!quark!quux 2 | 3 | call IsPlacedMarks({ 4 | 'b': 14, 'a': 13, 'c': 14, 'z': 31, 'd': 90, 'g': 14, 'f': 93, 'x': 30, 'y': 32, 'k': 20, 'e': 91, 'j': 98 5 | }, 'reorder all lowercase marks') 6 | 7 | 'C': 14 / 'a': 13 / 'b': 14 / 'c': 14 / 'd': 90 / 'e': 91 / 'f': 93 / 'j': 98 / 'k': 20 / 'x': 30 / 'y': 32 / 'z': 31 8 | 9 | s:ByHeader(), s:SortRanges(), Sorters#Ranges#Unfolded(), s:ParseExpressionAndSortArguments() 10 | 11 | Sorters#Ranges#ByHeader() Sorters#Ranges#Unfolded() s:ByHeader() s:Inner() s:JoinRanges() s:OuterOne() s:ParseExpressionAndSortArguments() s:SortRanges() 12 | -------------------------------------------------------------------------------- /tests/t4240-SortEach-unique.vim: -------------------------------------------------------------------------------- 1 | " Test unique sorting by elements. 2 | 3 | edit elements.txt 4 | 5 | 15,17SortEach /^\s\+\|,\_s*// u 6 | 8,11SortEach /,\s*\|,\n/ \/ / u 7 | 1,2SortEach /[-_]/!/ u 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t4250-SortEach-pattern.ok: -------------------------------------------------------------------------------- 1 | bar_max_baz_mix_nono_mono_foo_foobar_nox_quark_lulli_quux 2 | 3 | call IsPlacedMarks({ 4 | 'b': 14, 'a': 13, 'c': 14, 'z': 31, 'd': 90, 'g': 14, 'f': 93, 'x': 30, 'y': 32, 'k': 20, 'e': 91, 'j': 98 5 | }, 'reorder all lowercase marks') 6 | 7 | 'a': 13 'b': 14 'c': 14 'C': 14 'k': 20 'x': 30 'z': 31 'y': 32 'd': 90 'e': 91 'f': 93 'j': 98 8 | 9 | s:ByHeader(), s:ParseExpressionAndSortArguments(), s:SortRanges(), Sorters#Ranges#Unfolded() 10 | 11 | s:ByHeader() Sorters#Ranges#ByHeader() s:Inner() s:JoinRanges() s:OuterOne() s:ParseExpressionAndSortArguments() s:SortRanges() Sorters#Ranges#Unfolded() 12 | -------------------------------------------------------------------------------- /tests/t4250-SortEach-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test sorting with sort pattern by elements. 2 | 3 | edit elements.txt 4 | 5 | 15,17SortEach /^\s\+\|,\_s*// ru /\w\+()/ 6 | 13SortEach /^\s\+\|,\_s*// r /\w\+()/ 7 | 8,11SortEach /,\s*\|,\n/ / /'\a': / 8 | 1,2SortEach /[-_]/_/ /^./ 9 | 10 | call vimtest#SaveOut() 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /tests/t4260-SortEach-lastsearch.ok: -------------------------------------------------------------------------------- 1 | bar_baz-foo-mix_lulli-nono_mono-quux 2 | quark-max__nox-foobar 3 | 4 | call IsPlacedMarks({ 5 | 'a': 13 # 'b': 14 # 'c': 14 # 'd': 90 # 'e': 91 # 'f': 93 # 'g': 14 # 'j': 98 # 'k': 20 # 'x': 30 # 'y': 32 # 'z': 31 6 | }, 'reorder all lowercase marks') 7 | 8 | 'b': 13, 'c': 14,: 14, 'a' 9 | 'z': 31, 'd': 90, 'C': 14, 10 | 'f': 93, 'x': 30, 'y': 32, 11 | 'k': 20, 'e': 91, 'j': 98 12 | 13 | s:ByHeader(), s:Inner(), s:OuterOne(), Sorters#Ranges#ByHeader(), Sorters#Ranges#Unfolded(), Sorters#Ranges#Unfolded(), s:ByHeader(), s:ByHeader(), s:JoinRanges(), s:ParseExpressionAndSortArguments(), s:ParseExpressionAndSortArguments(), s:SortRanges(), s:SortRanges() 14 | -------------------------------------------------------------------------------- /tests/t4260-SortEach-lastsearch.vim: -------------------------------------------------------------------------------- 1 | " Test sorting by elements delimited by the last search pattern. 2 | 3 | edit elements.txt 4 | 5 | " Prime the command with an unrelated pattern. 6 | 8SortEach /: / 7 | 8 | let @/ = '-\|,\s*' 9 | 13,17SortEach /// 10 | 5SortEach // # / 11 | 1SortEach 12 | 13 | call vimtest#SaveOut() 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /tests/t4270-SortEach-no-elements.vim: -------------------------------------------------------------------------------- 1 | " Test sorting not a single element. 2 | 3 | edit elements.txt 4 | 5 | call vimtest#StartTap() 6 | call vimtap#Plan(3) 7 | 8 | call vimtap#err#ErrorsLike('^E486: ', '1SortEach /@/', 'error when no separators parsed') 9 | call vimtap#err#Errors('No elements to sort', '2SortEach /[^:;]*/', 'error on line that just consists of separators') 10 | call vimtap#err#Errors('No elements to sort', '3SortEach /.*/', 'error on empty line') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t5000-UniqAny.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 10 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 11 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 12 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 13 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 14 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 15 | -------------------------------------------------------------------------------- /tests/t5000-UniqAny.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique lines. 2 | 3 | edit uniq.txt 4 | UniqAny 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5010-UniqAny-range.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 10 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 11 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 12 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 13 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 14 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 15 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 18 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 19 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 20 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 21 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 22 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 23 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 24 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 25 | -------------------------------------------------------------------------------- /tests/t5010-UniqAny-range.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique lines within a range. 2 | 3 | edit uniq.txt 4 | 2,10UniqAny 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | call vimtap#Is(getpos("'["), [0, 2, 1, 0], 'start of change') 9 | call vimtap#Is(getpos("']"), [0, 8, 61, 0], 'end of change') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t5020-UniqAny-icase.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 10 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 11 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 12 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 13 | -------------------------------------------------------------------------------- /tests/t5020-UniqAny-icase.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique lines ignoring case. 2 | 3 | edit uniq.txt 4 | UniqAny i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5030-UniqAny-pattern.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 10 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 11 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 12 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 13 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 14 | -------------------------------------------------------------------------------- /tests/t5030-UniqAny-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique lines ignoring pattern. 2 | 3 | edit uniq.txt 4 | UniqAny /type: .*: / 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5040-UniqAny-pattern-non-matching.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 10 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 11 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 12 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 13 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 14 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 15 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 16 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 17 | -------------------------------------------------------------------------------- /tests/t5040-UniqAny-pattern-non-matching.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique lines ignoring pattern that only matches some lines. 2 | " Tests that the non-matching lines are kept duplicate and in the original 3 | " position. 4 | 5 | edit uniq.txt 6 | UniqAny /type: Business Rules id: / 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t5050-UniqAny-pattern-r.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 10 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 11 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 12 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 13 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 14 | -------------------------------------------------------------------------------- /tests/t5050-UniqAny-pattern-r.vim: -------------------------------------------------------------------------------- 1 | " Test keeping lines where only the matching pattern is unique. 2 | 3 | edit uniq.txt 4 | UniqAny /[[:xdigit:]-]\{10,}/r 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5060-UniqAny-pattern-icase-r.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 10 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 11 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 12 | -------------------------------------------------------------------------------- /tests/t5060-UniqAny-pattern-icase-r.vim: -------------------------------------------------------------------------------- 1 | " Test keeping lines where only the matching pattern is ignoring-case unique. 2 | " Tests that flags can be specified both before and after the pattern. 3 | 4 | edit uniq.txt 5 | UniqAny i/[[:xdigit:]-]\{10,}/r 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t5070-UniqAny-invalid-args.vim: -------------------------------------------------------------------------------- 1 | " Test passing invalid sort arguments. 2 | 3 | edit uniq.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(4) 6 | 7 | call vimtap#err#Errors('Invalid argument: doesnotexist', 'UniqAny doesnotexist', 'Error when passing invalid argument doesnotexist') 8 | call vimtap#err#Errors('Invalid argument: y z', 'UniqAny y z', 'Error when passing invalid argument y z') 9 | call vimtap#err#Errors('Invalid argument: /foo/y z', 'UniqAny /foo/y z', 'Error when passing invalid argument /foo/y z') 10 | call vimtap#err#Errors('Invalid argument: /foo', 'UniqAny /foo', 'Error when passing invalid argument /foo') 11 | 12 | call vimtest#SaveOut() 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /tests/t5100-UniqSubsequent.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 13 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 14 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 15 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 18 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 19 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 20 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 21 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 22 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 23 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 24 | -------------------------------------------------------------------------------- /tests/t5100-UniqSubsequent.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique subsequent lines. 2 | 3 | edit uniq.txt 4 | UniqSubsequent 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5110-UniqSubsequent-range.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 13 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 14 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 15 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 18 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 19 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 20 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 21 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 22 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 23 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 24 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 25 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 26 | -------------------------------------------------------------------------------- /tests/t5110-UniqSubsequent-range.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique subsequent lines within a range. 2 | 3 | edit uniq.txt 4 | 2,10UniqSubsequent 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | call vimtap#Is(getpos("'["), [0, 2, 1, 0], 'start of change') 9 | call vimtap#Is(getpos("']"), [0, 9, 61, 0], 'end of change') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t5120-UniqSubsequent-icase.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 13 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 14 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 15 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 16 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 17 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 18 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 19 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 20 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 21 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 22 | -------------------------------------------------------------------------------- /tests/t5120-UniqSubsequent-icase.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique subsequent lines ignoring case. 2 | 3 | edit uniq.txt 4 | UniqSubsequent i 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5130-UniqSubsequent-pattern.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 13 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 14 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 15 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 18 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 19 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 20 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 21 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 22 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 23 | -------------------------------------------------------------------------------- /tests/t5130-UniqSubsequent-pattern.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique subsequent lines ignoring pattern. 2 | 3 | edit uniq.txt 4 | UniqSubsequent /type: .*: / 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5140-UniqSubsequent-pattern-non-matching.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 13 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 14 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 15 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 18 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 19 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 20 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 21 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 22 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 23 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 24 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 25 | -------------------------------------------------------------------------------- /tests/t5140-UniqSubsequent-pattern-non-matching.vim: -------------------------------------------------------------------------------- 1 | " Test keeping unique subsequent lines ignoring pattern that only matches some lines. 2 | " Tests that the non-matching lines are kept duplicate and in the original 3 | " position. 4 | 5 | edit uniq.txt 6 | UniqSubsequent /type: Business Rules id: / 7 | 8 | call vimtest#SaveOut() 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /tests/t5150-UniqSubsequent-pattern-r.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 13 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 14 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 15 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 16 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 17 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 18 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 19 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 20 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 21 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 22 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 23 | -------------------------------------------------------------------------------- /tests/t5150-UniqSubsequent-pattern-r.vim: -------------------------------------------------------------------------------- 1 | " Test keeping subsequent lines where only the matching pattern is unique. 2 | 3 | edit uniq.txt 4 | UniqSubsequent /[[:xdigit:]-]\{10,}/r 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t5160-UniqSubsequent-pattern-icase-r.ok: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 6 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 7 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 8 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 9 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 10 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 11 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 12 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 13 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 14 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 15 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 16 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 17 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 18 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 19 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 20 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 21 | -------------------------------------------------------------------------------- /tests/t5160-UniqSubsequent-pattern-icase-r.vim: -------------------------------------------------------------------------------- 1 | " Test keeping subsequent lines where only the matching pattern is ignoring-case unique. 2 | " Tests that flags can be specified both before and after the pattern. 3 | 4 | edit uniq.txt 5 | UniqSubsequent i/[[:xdigit:]-]\{10,}/r 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t5170-UniqSubsequent-invalid-args.vim: -------------------------------------------------------------------------------- 1 | " Test passing invalid sort arguments. 2 | 3 | edit uniq.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(4) 6 | 7 | call vimtap#err#Errors('Invalid argument: doesnotexist', 'UniqSubsequent doesnotexist', 'Error when passing invalid argument doesnotexist') 8 | call vimtap#err#Errors('Invalid argument: y z', 'UniqSubsequent y z', 'Error when passing invalid argument y z') 9 | call vimtap#err#Errors('Invalid argument: /foo/y z', 'UniqSubsequent /foo/y z', 'Error when passing invalid argument /foo/y z') 10 | call vimtap#err#Errors('Invalid argument: /foo', 'UniqSubsequent /foo', 'Error when passing invalid argument /foo') 11 | 12 | call vimtest#SaveOut() 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /tests/t6000-ReorderVisible.ok: -------------------------------------------------------------------------------- 1 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 2 | 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Boilerplate 35 | " Code that is 36 | -------------------------------------------------------------------------------- /tests/t6000-ReorderVisible.vim: -------------------------------------------------------------------------------- 1 | " Test reordering visible lines. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | ReorderVisible reverse(v:val) 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t6010-ReorderVisible-no-folds.ok: -------------------------------------------------------------------------------- 1 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 2 | 3 | endfunction 4 | " Public function 5 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 6 | endfunction 7 | " Stuff elided. 8 | " Internal 9 | function! s:ByHeader( startLnum, endLnum, expr ) 10 | endfunction 11 | " Stuff elided. 12 | " Internal 13 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 14 | endfunction 15 | " Stuff elided. 16 | " Duplicate first line only 17 | function! s:ByHeader( startLnum, endLnum, expr ) 18 | endfunction 19 | " Stuff elided. 20 | " Internal 21 | function! s:ParseExpressionAndSortArguments( arguments ) 22 | 23 | endfunction 24 | " Public unrelated function 25 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 26 | endfunction 27 | " Stuff elided. 28 | " Internal 29 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 30 | endfunction 31 | " Stuff elided. 32 | " Internal 33 | function! s:ByHeader( startLnum, endLnum, expr ) 34 | " Boilerplate 35 | " Code that is 36 | -------------------------------------------------------------------------------- /tests/t6010-ReorderVisible-no-folds.vim: -------------------------------------------------------------------------------- 1 | " Test reordering all lines. 2 | 3 | edit functions.txt 4 | ReorderVisible reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6020-ReorderVisible-bad-expr.vim: -------------------------------------------------------------------------------- 1 | " Test reordering visible lines with bad expressions. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(2) 8 | 9 | call vimtap#err#ErrorsLike('^E471:', 'ReorderVisible', 'Error when no expression passed') 10 | call vimtap#err#ErrorsLike('^E15:', 'ReorderVisible 42 +', 'Error with invalid expression') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t6030-ReorderVisible-single-fold.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6030-ReorderVisible-single-fold.vim: -------------------------------------------------------------------------------- 1 | " Test reordering of a single closed fold. 2 | 3 | edit functions.txt 4 | %fold 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(1) 8 | 9 | call vimtap#err#ErrorsLike('Just a single range; nothing to reorder', 'ReorderVisible reverse(v:val)', 'Error with just a single closed fold') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t6040-ReorderVisible-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6040-ReorderVisible-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering visible lines within a range. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | 3,26ReorderVisible reverse(v:val) 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t6100-ReorderFolded.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Duplicate first line only 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6100-ReorderFolded.vim: -------------------------------------------------------------------------------- 1 | " Test reordering folded lines, keeping unfolded in between. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | ReorderFolded reverse(v:val) 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t6130-ReorderFolded-single-fold.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6130-ReorderFolded-single-fold.vim: -------------------------------------------------------------------------------- 1 | " Test reordering of a single closed fold. 2 | 3 | edit functions.txt 4 | %fold 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(1) 8 | 9 | call vimtap#err#ErrorsLike('Just a single range; nothing to reorder', 'ReorderFolded reverse(v:val)', 'Error with just a single closed fold') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t6140-ReorderFolded-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6140-ReorderFolded-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering folded lines, keeping unfolded in between, within a range. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | 3,26ReorderFolded reverse(v:val) 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t6200-ReorderUnfolded.ok: -------------------------------------------------------------------------------- 1 | 2 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | " Code that is 35 | " Boilerplate 36 | -------------------------------------------------------------------------------- /tests/t6200-ReorderUnfolded.vim: -------------------------------------------------------------------------------- 1 | " Test reordering unfolded lines, keeping folded in between. 2 | 3 | edit functions.txt 4 | global/^function/,/^endfunction/fold 5 | ReorderUnfolded reverse(v:val) 6 | 7 | call vimtest#SaveOut() 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /tests/t6300-ReorderByHeader.ok: -------------------------------------------------------------------------------- 1 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 2 | " Public function 3 | endfunction 4 | 5 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 23 | " Public unrelated function 24 | endfunction 25 | 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Code that is 35 | " Boilerplate 36 | -------------------------------------------------------------------------------- /tests/t6300-ReorderByHeader.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by start of functions. 2 | 3 | edit functions.txt 4 | ReorderByHeader /^function/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6310-ReorderByHeader-bad.vim: -------------------------------------------------------------------------------- 1 | " Test bad arguments to ReorderByHeader. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(3) 6 | 7 | call vimtap#err#Errors('Must pass both /{expr}/ and {reorder-expr}', 'ReorderByHeader /^function/', 'Error when /{expr}/ is omitted') 8 | call vimtap#err#Errors('Must pass both /{expr}/ and {reorder-expr}', 'ReorderByHeader reverse(v:val)', 'Error when {reorder-expr} is omitted') 9 | call vimtap#err#ErrorsLike('^E54:', 'ReorderByHeader /^foo\(bar/ reverse(v:val)', 'Error with invalid pattern') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t6330-ReorderByHeader-no-match.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:ByHeader( startLnum, endLnum, expr ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 8 | " Internal 9 | " Stuff elided. 10 | endfunction 11 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 12 | " Public unrelated function 13 | endfunction 14 | 15 | function! s:ParseExpressionAndSortArguments( arguments ) 16 | " Internal 17 | " Stuff elided. 18 | endfunction 19 | function! s:ByHeader( startLnum, endLnum, expr ) 20 | " Duplicate first line only 21 | " Stuff elided. 22 | endfunction 23 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6330-ReorderByHeader-no-match.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by something that does not match at all. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(1) 6 | 7 | call vimtap#err#Errors('Just a single range; nothing to reorder', 'ReorderByHeader /^doesNotMatch/ reverse(v:val)', 'Error when /{expr}/ does not match at all') 8 | 9 | call vimtest#SaveOut() 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /tests/t6340-ReorderByHeader-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 16 | " Public unrelated function 17 | endfunction 18 | 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6340-ReorderByHeader-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by start of functions, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderByHeader /^function/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6400-ReorderOnlyByMatch.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Duplicate first line only 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6400-ReorderOnlyByMatch.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions. 2 | 3 | edit functions.txt 4 | ReorderOnlyByMatch /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6410-ReorderOnlyByMatch-bad.vim: -------------------------------------------------------------------------------- 1 | " Test bad arguments to ReorderOnlyByMatch. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(3) 6 | 7 | call vimtap#err#Errors('Must pass both /{expr}/ and {reorder-expr}', 'ReorderOnlyByMatch /^function/', 'Error when /{expr}/ is omitted') 8 | call vimtap#err#Errors('Must pass both /{expr}/ and {reorder-expr}', 'ReorderOnlyByMatch reverse(v:val)', 'Error when {reorder-expr} is omitted') 9 | call vimtap#err#ErrorsLike('^E54:', 'ReorderOnlyByMatch /^foo\(bar/ reverse(v:val)', 'Error with invalid pattern') 10 | 11 | call vimtest#SaveOut() 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /tests/t6440-ReorderOnlyByMatch-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6440-ReorderOnlyByMatch-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderOnlyByMatch /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6500-ReorderByMatchAndNonMatches.ok: -------------------------------------------------------------------------------- 1 | 2 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Code that is 35 | " Boilerplate 36 | -------------------------------------------------------------------------------- /tests/t6500-ReorderByMatchAndNonMatches.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions and surroundings. 2 | 3 | edit functions.txt 4 | ReorderByMatchAndNonMatches /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6540-ReorderByMatchAndNonMatches-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6540-ReorderByMatchAndNonMatches-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions and surroundings, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderByMatchAndNonMatches /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6600-ReorderByMatchAndLines.ok: -------------------------------------------------------------------------------- 1 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 2 | 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Boilerplate 35 | " Code that is 36 | -------------------------------------------------------------------------------- /tests/t6600-ReorderByMatchAndLines.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions and surrounding lines. 2 | 3 | edit functions.txt 4 | ReorderByMatchAndLines /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6640-ReorderByMatchAndLines-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6640-ReorderByMatchAndLines-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by matched functions and surrounding lines, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderByMatchAndLines /^function\_.\{-}\nendfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6700-ReorderOnlyByRange.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | 15 | function! s:ByHeader( startLnum, endLnum, expr ) 16 | " Duplicate first line only 17 | " Stuff elided. 18 | endfunction 19 | function! s:ParseExpressionAndSortArguments( arguments ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6700-ReorderOnlyByRange.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range. 2 | 3 | edit functions.txt 4 | ReorderOnlyByRange /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6710-ReorderOnlyByRange-bad.vim: -------------------------------------------------------------------------------- 1 | " Test bad arguments to ReorderOnlyByRange. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(4) 6 | 7 | call vimtap#err#Errors('Must pass both {range} and {reorder-expr}', 'ReorderOnlyByRange /^function/,/^endfunction$/', 'Error when {range} is omitted') 8 | call vimtap#err#Errors('Must pass both {range} and {reorder-expr}', 'ReorderOnlyByRange reverse(v:val)', 'Error when {reorder-expr} is omitted') 9 | 10 | call vimtap#err#Errors('Just a single range; nothing to reorder', 'ReorderOnlyByRange /^foo\(bar/,$ reverse(v:val)', 'Error with invalid pattern in range is suppressed but results in a single range') 11 | call vimtap#err#Errors('Just a single range; nothing to reorder', 'ReorderOnlyByRange 1,999 reverse(v:val)', 'Error with out-of-bounds range is suppressed by results in a single range') 12 | 13 | call vimtest#SaveOut() 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /tests/t6730-ReorderOnlyByRange-no-match.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by a single area. 2 | 3 | edit functions.txt 4 | call vimtest#StartTap() 5 | call vimtap#Plan(2) 6 | 7 | call vimtap#err#Errors('Just a single range; nothing to reorder', 'ReorderOnlyByRange /^doesNotMatch/ reverse(v:val)', 'Error when {range} does not match at all') 8 | call vimtap#err#Errors('Just a single range; nothing to reorder', 'ReorderOnlyByRange 1,$ reverse(v:val)', 'Error when {range} is the entire buffer') 9 | 10 | call vimtest#SaveOut() 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /tests/t6740-ReorderOnlyByRange-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6740-ReorderOnlyByRange-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderOnlyByRange /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6800-ReorderByRangeAndNonMatches.ok: -------------------------------------------------------------------------------- 1 | 2 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Code that is 35 | " Boilerplate 36 | -------------------------------------------------------------------------------- /tests/t6800-ReorderByRangeAndNonMatches.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range and surroundings. 2 | 3 | edit functions.txt 4 | ReorderByRangeAndNonMatches /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6840-ReorderByRangeAndNonMatches-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6840-ReorderByRangeAndNonMatches-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range and surroundings, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderByRangeAndNonMatches /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6900-ReorderByRangeAndLines.ok: -------------------------------------------------------------------------------- 1 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 2 | 3 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 4 | " Public function 5 | endfunction 6 | function! s:ByHeader( startLnum, endLnum, expr ) 7 | " Internal 8 | " Stuff elided. 9 | endfunction 10 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 11 | " Internal 12 | " Stuff elided. 13 | endfunction 14 | function! s:ByHeader( startLnum, endLnum, expr ) 15 | " Duplicate first line only 16 | " Stuff elided. 17 | endfunction 18 | function! s:ParseExpressionAndSortArguments( arguments ) 19 | " Internal 20 | " Stuff elided. 21 | endfunction 22 | 23 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 24 | " Public unrelated function 25 | endfunction 26 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 27 | " Internal 28 | " Stuff elided. 29 | endfunction 30 | function! s:ByHeader( startLnum, endLnum, expr ) 31 | " Internal 32 | " Stuff elided. 33 | endfunction 34 | " Boilerplate 35 | " Code that is 36 | -------------------------------------------------------------------------------- /tests/t6900-ReorderByRangeAndLines.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range and surrounding lines. 2 | 3 | edit functions.txt 4 | ReorderByRangeAndLines /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/t6940-ReorderByRangeAndLines-range.ok: -------------------------------------------------------------------------------- 1 | " Code that is 2 | " Boilerplate 3 | function! s:JoinRanges( bang, startLnum, endLnum, arguments, RangeCreator ) 4 | " Internal 5 | " Stuff elided. 6 | endfunction 7 | function! s:ByHeader( startLnum, endLnum, expr ) 8 | " Duplicate first line only 9 | " Stuff elided. 10 | endfunction 11 | function! s:ParseExpressionAndSortArguments( arguments ) 12 | " Internal 13 | " Stuff elided. 14 | endfunction 15 | 16 | function! Sorters#Ranges#Unfolded( bang, startLnum, endLnum, sortArgs ) 17 | " Public unrelated function 18 | endfunction 19 | function! s:SortRanges( bang, startLnum, endLnum, sortArgs, rangeName, rangeNum, joinCnt ) 20 | " Internal 21 | " Stuff elided. 22 | endfunction 23 | function! s:ByHeader( startLnum, endLnum, expr ) 24 | " Internal 25 | " Stuff elided. 26 | endfunction 27 | function! s:ByHeader( startLnum, endLnum, expr ) 28 | " Internal 29 | " Stuff elided. 30 | endfunction 31 | function! Sorters#Ranges#ByHeader( bang, startLnum, endLnum, arguments ) 32 | " Public function 33 | endfunction 34 | 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab : 36 | -------------------------------------------------------------------------------- /tests/t6940-ReorderByRangeAndLines-range.vim: -------------------------------------------------------------------------------- 1 | " Test reordering by range and surrounding lines, within a range. 2 | 3 | edit functions.txt 4 | 3,26ReorderByRangeAndLines /^function/,/^endfunction$/ reverse(v:val) 5 | 6 | call vimtest#SaveOut() 7 | call vimtest#Quit() 8 | -------------------------------------------------------------------------------- /tests/uniq.txt: -------------------------------------------------------------------------------- 1 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 2 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 3 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 4 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 5 | type: Business Rules id: 12288dd2-af01-4d7c-b1ff-837bfbdf409b 6 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 7 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 8 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 9 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 10 | type: Business Rules id: 5c837c2a-0650-4efb-9e59-933cefda3ea2 11 | type: Business Rules id: 6cf81bd4-3179-4971-979a-26e91a16e387 12 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 13 | type: BUSINESS RULES id: 47211BA9-6E16-48D5-B42E-7E4812C02553 14 | type: Business Rules id: 47211ba9-6e16-48d5-b42e-7e4812c02553 15 | type: Business Rules id: 12288DD2-AF01-4D7C-B1FF-837BFBDF409B 16 | type: Business Rules id: 881ed3f0-5f49-4242-95f2-28f77ec21e98 17 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 18 | type: Context Menus id: a14a41b3-1012-45af-8a1f-dbfe25b19b61 19 | type: Business Rules id: 6cd37dad-9554-405c-a3b7-5b959e1a13dc 20 | type: Business Rules id: 02c38d1f-015d-4f7b-b9ce-9f625268bcb6 21 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 22 | type: Context Menus id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 23 | type: Business Rules id: 6cd37dad-af9d-48f3-8b42-3e0bb79b5529 24 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 25 | type: Business Rules id: 9ca52ef9-4aa3-4752-826e-f3aeefe83572 26 | type: Business Rules id: cffd00a3-d74c-48ee-b971-af36e4b98b3c 27 | -------------------------------------------------------------------------------- /tests/words.txt: -------------------------------------------------------------------------------- 1 | y x z w v u 2 | b a d f c e 3 | 4 | 5 | " Code that is 6 | " Boilerplate 7 | 8 | 9 | s:ByHeader() 10 | 11 | s:SortRanges() 12 | Sorters#Ranges#Unfolded() 13 | s:ParseExpressionAndSortArguments() 14 | s:ByHeader() s:JoinRanges() s:ByHeader() Sorters#Ranges#ByHeader() 15 | s:InnerOne() 16 | --------------------------------------------------------------------------------