├── .gitignore ├── AUTHORS ├── LICENSE ├── Makefile ├── README.md ├── bin ├── gvem ├── nvem └── vem ├── doc └── img │ ├── vem-logo.png │ └── vem-main-screenshot.png ├── plugins ├── .gitkeep ├── CamelCaseMotion │ ├── .gitignore │ ├── .gitrepo │ ├── CHANGES.md │ ├── README.md │ ├── autoload │ │ └── camelcasemotion.vim │ ├── doc │ │ └── camelcasemotion.txt │ └── plugin │ │ └── camelcasemotion.vim ├── ctrlp.vim │ ├── .gitignore │ ├── LICENSE │ ├── autoload │ │ ├── ctrlp.vim │ │ └── ctrlp │ │ │ ├── autoignore.vim │ │ │ ├── bookmarkdir.vim │ │ │ ├── buffertag.vim │ │ │ ├── changes.vim │ │ │ ├── dir.vim │ │ │ ├── line.vim │ │ │ ├── mixed.vim │ │ │ ├── mrufiles.vim │ │ │ ├── quickfix.vim │ │ │ ├── rtscript.vim │ │ │ ├── tag.vim │ │ │ ├── undo.vim │ │ │ └── utils.vim │ ├── doc │ │ ├── ctrlp.cnx │ │ └── ctrlp.txt │ ├── plugin │ │ └── ctrlp.vim │ └── readme.md ├── matchit │ ├── .gitrepo │ ├── README.md │ ├── autoload │ │ └── matchit.vim │ ├── doc │ │ ├── matchit.txt │ │ └── tags │ └── plugin │ │ └── matchit.vim ├── nerdcommenter │ ├── .gitignore │ ├── README.md │ ├── Rakefile │ ├── doc │ │ └── NERD_commenter.txt │ └── plugin │ │ └── NERD_commenter.vim ├── vem-dark │ ├── .gitrepo │ ├── LICENSE │ ├── README.md │ ├── colors │ │ └── vem-dark.vim │ └── screenshots │ │ ├── vem-dark-16.png │ │ ├── vem-dark-24bit.png │ │ ├── vem-dark-256.png │ │ ├── vem-dark-example.png │ │ └── vem-dark-gui.png ├── vem-statusline │ ├── LICENSE │ ├── README.md │ ├── autoload │ │ ├── vem_statusline.vim │ │ └── vem_statusline │ │ │ └── filename_format.vim │ ├── doc │ │ ├── images │ │ │ ├── vem-statusline-dark.png │ │ │ └── vem-statusline-light.png │ │ └── statusline.txt │ └── plugin │ │ └── vem_statusline.vim ├── vem-tabline │ ├── .gitrepo │ ├── LICENSE │ ├── README.md │ ├── autoload │ │ ├── vem_tabline.vim │ │ └── vem_tabline │ │ │ ├── buffers.vim │ │ │ ├── separator.vim │ │ │ └── tabpages.vim │ ├── doc │ │ ├── screenshots │ │ │ ├── color-scheme-example.png │ │ │ └── one-window.png │ │ └── tabline.txt │ └── plugin │ │ └── vem_tabline.vim ├── vim-EnhancedJumps │ ├── .gitignore │ ├── EnhancedJumps.manifest │ ├── README.md │ ├── autoload │ │ ├── EnhancedJumps.vim │ │ └── EnhancedJumps │ │ │ ├── Changes.vim │ │ │ └── Common.vim │ ├── doc │ │ └── EnhancedJumps.txt │ └── plugin │ │ └── EnhancedJumps.vim ├── vim-filebeagle │ ├── README.md │ ├── autoload │ │ └── filebeagle.vim │ ├── doc │ │ └── filebeagle.txt │ └── plugin │ │ └── filebeagle.vim ├── vim-ingo-library │ ├── .gitignore │ ├── README.md │ ├── autoload │ │ └── ingo │ │ │ ├── actions.vim │ │ │ ├── actions │ │ │ ├── iterations.vim │ │ │ └── special.vim │ │ │ ├── area.vim │ │ │ ├── area │ │ │ └── frompattern.vim │ │ │ ├── avoidprompt.vim │ │ │ ├── binary.vim │ │ │ ├── buffer.vim │ │ │ ├── buffer │ │ │ ├── ephemeral.vim │ │ │ ├── generate.vim │ │ │ ├── locate.vim │ │ │ ├── scratch.vim │ │ │ ├── temp.vim │ │ │ ├── temprange.vim │ │ │ └── visible.vim │ │ │ ├── change.vim │ │ │ ├── cmdargs.vim │ │ │ ├── cmdargs │ │ │ ├── command.vim │ │ │ ├── commandcommands.vim │ │ │ ├── file.vim │ │ │ ├── glob.vim │ │ │ ├── pattern.vim │ │ │ ├── range.vim │ │ │ ├── register.vim │ │ │ └── substitute.vim │ │ │ ├── cmdline │ │ │ └── showmode.vim │ │ │ ├── cmdrange.vim │ │ │ ├── cmdrangeconverter.vim │ │ │ ├── codec │ │ │ └── URL.vim │ │ │ ├── collections.vim │ │ │ ├── collections │ │ │ ├── differences.vim │ │ │ ├── find.vim │ │ │ ├── fromsplit.vim │ │ │ ├── memoized.vim │ │ │ ├── permute.vim │ │ │ ├── recursive.vim │ │ │ ├── rotate.vim │ │ │ └── unique.vim │ │ │ ├── comments.vim │ │ │ ├── compat.vim │ │ │ ├── compat │ │ │ ├── command.vim │ │ │ ├── commands.vim │ │ │ ├── complete.vim │ │ │ ├── regexp.vim │ │ │ ├── shellcommand.vim │ │ │ └── window.vim │ │ │ ├── cursor.vim │ │ │ ├── cursor │ │ │ ├── keep.vim │ │ │ └── move.vim │ │ │ ├── date.vim │ │ │ ├── date │ │ │ ├── epoch.vim │ │ │ └── format.vim │ │ │ ├── dict.vim │ │ │ ├── dict │ │ │ ├── count.vim │ │ │ └── find.vim │ │ │ ├── digest.vim │ │ │ ├── encoding.vim │ │ │ ├── err.vim │ │ │ ├── escape.vim │ │ │ ├── escape │ │ │ ├── command.vim │ │ │ ├── file.vim │ │ │ └── shellcommand.vim │ │ │ ├── event.vim │ │ │ ├── external.vim │ │ │ ├── file.vim │ │ │ ├── filetype.vim │ │ │ ├── folds.vim │ │ │ ├── folds │ │ │ ├── containment.vim │ │ │ └── persistence.vim │ │ │ ├── foldtext.vim │ │ │ ├── format.vim │ │ │ ├── format │ │ │ └── columns.vim │ │ │ ├── fs │ │ │ ├── path.vim │ │ │ ├── path │ │ │ │ ├── asfilename.vim │ │ │ │ └── split.vim │ │ │ ├── tempfile.vim │ │ │ └── traversal.vim │ │ │ ├── ftplugin │ │ │ ├── converter │ │ │ │ └── external.vim │ │ │ ├── onbufwinenter.vim │ │ │ ├── setting.vim │ │ │ └── windowsettings.vim │ │ │ ├── funcref.vim │ │ │ ├── function │ │ │ └── uniquify.vim │ │ │ ├── gui │ │ │ └── position.vim │ │ │ ├── hlgroup.vim │ │ │ ├── indent.vim │ │ │ ├── join.vim │ │ │ ├── line │ │ │ └── replace.vim │ │ │ ├── lines.vim │ │ │ ├── lines │ │ │ ├── empty.vim │ │ │ └── replace.vim │ │ │ ├── list.vim │ │ │ ├── list │ │ │ ├── find.vim │ │ │ ├── lcs.vim │ │ │ ├── pattern.vim │ │ │ ├── sequence.vim │ │ │ └── split.vim │ │ │ ├── lists.vim │ │ │ ├── lists │ │ │ └── find.vim │ │ │ ├── lnum.vim │ │ │ ├── mapmaker.vim │ │ │ ├── matches.vim │ │ │ ├── math.vim │ │ │ ├── mbyte │ │ │ └── virtcol.vim │ │ │ ├── motion │ │ │ ├── boundary.vim │ │ │ ├── helper.vim │ │ │ └── omap.vim │ │ │ ├── msg.vim │ │ │ ├── nary.vim │ │ │ ├── number.vim │ │ │ ├── option.vim │ │ │ ├── os.vim │ │ │ ├── plugin │ │ │ ├── cmd │ │ │ │ └── withpattern.vim │ │ │ ├── cmdcomplete.vim │ │ │ ├── compiler.vim │ │ │ ├── marks.vim │ │ │ ├── persistence.vim │ │ │ ├── rendered.vim │ │ │ ├── rendered │ │ │ │ ├── Confirmeach.vim │ │ │ │ └── Subset.vim │ │ │ └── setting.vim │ │ │ ├── pos.vim │ │ │ ├── print.vim │ │ │ ├── query.vim │ │ │ ├── query │ │ │ ├── confirm.vim │ │ │ ├── file.vim │ │ │ ├── fromlist.vim │ │ │ ├── get.vim │ │ │ ├── recall.vim │ │ │ └── substitute.vim │ │ │ ├── range.vim │ │ │ ├── range │ │ │ ├── borders.vim │ │ │ ├── invert.vim │ │ │ ├── lines.vim │ │ │ └── merge.vim │ │ │ ├── record.vim │ │ │ ├── regexp.vim │ │ │ ├── regexp │ │ │ ├── build.vim │ │ │ ├── capture.vim │ │ │ ├── collection.vim │ │ │ ├── comments.vim │ │ │ ├── deconstruct.vim │ │ │ ├── fromwildcard.vim │ │ │ ├── length.vim │ │ │ ├── magic.vim │ │ │ ├── multi.vim │ │ │ ├── pairs.vim │ │ │ ├── previoussubstitution.vim │ │ │ ├── split.vim │ │ │ └── virtcols.vim │ │ │ ├── register.vim │ │ │ ├── register │ │ │ └── accumulate.vim │ │ │ ├── search │ │ │ ├── buffer.vim │ │ │ ├── pattern.vim │ │ │ └── timelimited.vim │ │ │ ├── selection.vim │ │ │ ├── selection │ │ │ ├── area.vim │ │ │ ├── frompattern.vim │ │ │ ├── patternmatch.vim │ │ │ └── virtcols.vim │ │ │ ├── smartcase.vim │ │ │ ├── str.vim │ │ │ ├── str │ │ │ ├── find.vim │ │ │ ├── frompattern.vim │ │ │ ├── fromrange.vim │ │ │ ├── join.vim │ │ │ ├── list.vim │ │ │ ├── restricted.vim │ │ │ └── split.vim │ │ │ ├── strdisplaywidth.vim │ │ │ ├── strdisplaywidth │ │ │ └── pad.vim │ │ │ ├── subs │ │ │ ├── BraceCreation.vim │ │ │ └── BraceExpansion.vim │ │ │ ├── subst.vim │ │ │ ├── subst │ │ │ ├── expr │ │ │ │ └── emulation.vim │ │ │ ├── pairs.vim │ │ │ └── replacement.vim │ │ │ ├── swap.vim │ │ │ ├── syntaxitem.vim │ │ │ ├── system.vim │ │ │ ├── tabpage.vim │ │ │ ├── tabstops.vim │ │ │ ├── text.vim │ │ │ ├── text │ │ │ ├── frompattern.vim │ │ │ └── replace.vim │ │ │ ├── undo.vim │ │ │ ├── units.vim │ │ │ ├── view.vim │ │ │ ├── window.vim │ │ │ ├── window │ │ │ ├── adjacent.vim │ │ │ ├── cmdwin.vim │ │ │ ├── dimensions.vim │ │ │ ├── locate.vim │ │ │ ├── preview.vim │ │ │ ├── quickfix.vim │ │ │ ├── special.vim │ │ │ └── switches.vim │ │ │ └── workingdir.vim │ ├── doc │ │ └── ingo-library.txt │ ├── ingo-library.manifest │ └── tests │ │ ├── EchoLine.txt │ │ ├── all.suite │ │ ├── cmdargs │ │ └── file │ │ │ ├── t1000-FilterFileOptionsAndCommands.vim │ │ │ ├── t1010-FilterFileOptionsAndCommands-side-effects.vim │ │ │ ├── t1020-FilterFileOptionsAndCommandsToEscaped.vim │ │ │ ├── t1100-FilterFileOptions.vim │ │ │ ├── t1110-FilterFileOptions-side-effects.vim │ │ │ ├── t1120-FilterFileOptionsToEscaped.vim │ │ │ ├── t1200-FileOptionsAndCommandsToEscapedExCommandLine.vim │ │ │ └── t1210-FileOptionsAndCommandsToEscapedExCommandLine-no-side-effect.vim │ │ ├── collections │ │ ├── recursive │ │ │ ├── t1000-map.vim │ │ │ └── t1010-map-simple.vim │ │ ├── t1000-SplitKeepSeparators.vim │ │ ├── t1100-SeparateItemsAndSeparators.vim │ │ ├── t1200-SplitIntoMatches.vim │ │ ├── t1210-SplitIntoMatches-allowedDiscardPattern.vim │ │ ├── t2000-SortOnOneAttribute.vim │ │ ├── t2010-PrioritySort.vim │ │ └── t2020-SortOnTwoAttributes.vim │ │ ├── compat │ │ ├── helpers │ │ │ └── CompatChecker.vim │ │ ├── t1000-matchstrpos.vim │ │ ├── t1100-trim.vim │ │ └── t1200-strcharpart.vim │ │ ├── date │ │ └── t1000-strftime.vim │ │ ├── digest │ │ ├── t1000-get.vim │ │ └── t1010-get-long.vim │ │ ├── file │ │ ├── ipsum.txt │ │ ├── lorem.txt │ │ ├── nulla.txt │ │ ├── t1000-GetLines-uncached.vim │ │ ├── t1010-GetLines-cached.vim │ │ ├── t1020-GetLines-cache-too-small.vim │ │ ├── t1030-GetLines-immutable-cache.vim │ │ ├── t1040-GetLines-nonexisting-file.vim │ │ └── t1050-GetLines-cache-update.vim │ │ ├── fs │ │ └── paths │ │ │ └── split │ │ │ ├── t1000-TruncateTo.vim │ │ │ ├── t1010-TruncateTo-backslash.vim │ │ │ └── t1020-TruncateTo-truncation-indicator.vim │ │ ├── function │ │ └── uniquify │ │ │ ├── t1000-ReturnValue.vim │ │ │ ├── t1010-ReturnValue-scopes.vim │ │ │ ├── t1050-Clear.vim │ │ │ └── t1060-SetMaxAttempts.vim │ │ ├── list │ │ ├── lcs │ │ │ ├── t1000-FindLongestCommon.vim │ │ │ ├── t1010-FindLongestCommon-minimumLength.vim │ │ │ ├── t2000-FindAllCommon.vim │ │ │ ├── t2010-FindAllCommon-minimumCommon.vim │ │ │ └── t2020-FindAllCommon-minimumDiffering.vim │ │ ├── pattern │ │ │ ├── t1000-AllItemsMatch.vim │ │ │ ├── t1100-FirstMatchIndex.vim │ │ │ ├── t1110-FirstMatch.vim │ │ │ ├── t1200-AllMatchIndices.vim │ │ │ └── t1210-AllMatches.vim │ │ ├── sequence │ │ │ ├── t1000-FindNumerical.vim │ │ │ └── t1010-FindCharacter.vim │ │ ├── split │ │ │ └── t1000-RemoveFromStartWhilePredicate.vim │ │ └── t1000-AddNonEmpty.vim │ │ ├── lists │ │ └── t1000-StartsWith.vim │ │ ├── lnum │ │ └── t1000-AddOffsetWithWrapping.vim │ │ ├── matches │ │ ├── t1000-Any.vim │ │ ├── t1010-All.vim │ │ └── t2000-CountMatches.vim │ │ ├── regexp │ │ ├── capture │ │ │ └── t1000-MakeCapturing.vim │ │ ├── collection │ │ │ └── t1000-ToBranches.vim │ │ ├── deconstruct │ │ │ ├── t1000-RemovePositionAtoms.vim │ │ │ ├── t1100-RemoveMultis.vim │ │ │ ├── t2000-UnescapeSpecialCharacters.vim │ │ │ └── t3000-ToQuasiLiteral.vim │ │ ├── length │ │ │ ├── t1000-Project-basic.vim │ │ │ ├── t1010-Project-multis.vim │ │ │ ├── t1015-Project-multis.vim │ │ │ ├── t1020-Project-nested-branches.vim │ │ │ ├── t1030-Project-patterns.vim │ │ │ ├── t1040-Project-collection.vim │ │ │ ├── t1050-Project-global-flags.vim │ │ │ ├── t1090-Project-combinations.vim │ │ │ └── t1100-Project-invalid.vim │ │ ├── split │ │ │ ├── t1000-TopLevelBranches.vim │ │ │ ├── t2000-PrefixGroupsSuffix.vim │ │ │ ├── t2090-PrefixGroupsSuffix-invalid.vim │ │ │ ├── t3000-AddPatternByProjectedMatchLength-literals.vim │ │ │ ├── t3010-AddPatternByProjectedMatchLength-minmax.vim │ │ │ ├── t3090-AddPatternByProjectedMatchLength-invalid.vim │ │ │ └── t4000-GlobalFlags.vim │ │ └── t1000-IsValid.vim │ │ ├── str │ │ ├── t1000-Trim.vim │ │ └── t1100-TrimPattern.vim │ │ ├── strdisplaywidth │ │ ├── pad │ │ │ ├── t1000-Repeat.vim │ │ │ ├── t1100-RepeatExact.vim │ │ │ └── t1110-RepeatExact-filler.vim │ │ └── t1000-strleft.vim │ │ ├── subs │ │ ├── BraceCreation │ │ │ ├── t1000-BraceCreation.vim │ │ │ ├── t1010-BraceCreation-options.vim │ │ │ ├── t1020-BraceCreation-strict.vim │ │ │ └── t1030-BraceCreation-0numbers.vim │ │ └── BraceExpansion │ │ │ ├── t1000-BraceExpansion.vim │ │ │ ├── t1010-BraceExpansion-options.vim │ │ │ ├── t1020-BraceExpansion-minimal.vim │ │ │ └── t1030-BraceExpansion-sequences.vim │ │ └── subst │ │ ├── expr │ │ └── t1000-emulation.vim │ │ └── t1000-Indexed.vim ├── vim-sayonara │ ├── LICENSE │ ├── README.md │ ├── doc │ │ └── sayonara.txt │ ├── image │ │ └── sayonara.png │ ├── plugin │ │ └── sayonara.vim │ └── test │ │ ├── README.adoc │ │ ├── file.txt │ │ ├── file2.txt │ │ ├── init.vim │ │ ├── test_2tab_1win_2buf.vim │ │ └── test_2tab_4win_1buf.vim ├── vim-smartword │ ├── .gitignore │ ├── .travis.yml │ ├── Gemfile │ ├── Rakefile │ ├── VimFlavor │ ├── autoload │ │ └── smartword.vim │ ├── doc │ │ └── smartword.txt │ ├── plugin │ │ └── smartword.vim │ └── t │ │ ├── count.vim │ │ ├── customized-basic-motions.vim │ │ ├── fixtures │ │ ├── multiple-lines.vim │ │ └── sample.txt │ │ ├── multiple-lines.vim │ │ ├── single-line.vim │ │ └── ui.vim ├── vim-surround │ ├── README.markdown │ ├── doc │ │ └── surround.txt │ └── plugin │ │ └── surround.vim └── wildfire.vim │ ├── LICENSE.txt │ ├── README.md │ ├── _assets │ ├── preview.gif │ └── quickselect.gif │ ├── autoload │ ├── wildfire.vim │ └── wildfire │ │ └── triggers.vim │ ├── doc │ └── wildfire.txt │ └── plugin │ └── wildfire.vim ├── runtime └── autoload │ ├── pathogen.vim │ └── vem │ ├── buffers.vim │ ├── debug.vim │ ├── insert.vim │ ├── layouts.vim │ ├── move.vim │ └── select.vim ├── src ├── custom-conf.vim ├── mappings.vim ├── mappings │ ├── buffers.vim │ ├── clipboard.vim │ ├── comments.vim │ ├── delete.vim │ ├── format.vim │ ├── insert.vim │ ├── macros.vim │ ├── marks.vim │ ├── misc.vim │ ├── modes.vim │ ├── move.vim │ ├── quickfix.vim │ ├── replace.vim │ ├── scroll.vim │ ├── search.vim │ ├── select-objects.vim │ ├── select.vim │ ├── spelling.vim │ ├── surround.vim │ ├── tabpages.vim │ ├── undo.vim │ └── windows.vim ├── plugin-conf │ ├── ctrlp.vim │ ├── enhancedjumps.vim │ ├── nerdcommenter.vim │ ├── netrw.vim │ ├── vim-filebeagle.vim │ ├── vim-surround.vim │ └── wildfire.vim ├── runtime.vim ├── settings-gui.vim ├── settings.vim └── user-dirs.vim ├── tests ├── edit-test ├── expected │ ├── W.txt │ ├── a-z.txt │ ├── i-o.txt │ ├── w-sw.txt │ └── y-n.txt ├── input │ ├── W.txt │ ├── a-z.txt │ ├── i-o.txt │ ├── w-sw.txt │ └── y-n.txt ├── output │ ├── W.txt │ ├── a-z.txt │ ├── i-o.txt │ ├── w-sw.txt │ └── y-n.txt ├── run-tests ├── samples │ ├── one.txt │ └── two.txt ├── script │ ├── W.txt │ ├── a-z.txt │ ├── i-o.txt │ ├── w-sw.txt │ └── y-n.txt └── view-test └── vemrc /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.orig 3 | .DS_Store 4 | /tags 5 | /backup 6 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Vem is written and maintained by 2 | 3 | Andrés Sopeña Pérez (Pacha) 4 | 5 | Vem uses code from the following projects and authors: 6 | 7 | * vim-pathogen by Tim Pope 8 | * vim-filebeagle by Jeet Sukumaran 9 | * vim-smartword by Kana Natsuno 10 | * vim-enhancedjumps by Ingo Karkat 11 | * wildfire.vim by Giacomo Comitti 12 | * vim-surround by Tim Pope 13 | * ctrlp.vim originally by @kien, maintained by @mattn 14 | * NERD Commenter by Martin Grenfell 15 | * vim-sayonara by Marco Hinz 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Andrés Sopeña Pérez. See AUTHORS for more details. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | installation_dir=/usr/local/share/vem10 3 | installation_symlink=/usr/local/share/vem 4 | bin_dir=/usr/local/bin 5 | 6 | scripts=vem gvem nvem 7 | 8 | .PHONY: all 9 | all: 10 | @echo "Use 'make install' to install Vem" 11 | 12 | install: $(installation_dir) $(scripts) 13 | 14 | .PHONY: $(installation_dir) 15 | $(installation_dir): 16 | mkdir -p $@ 17 | cp -r * $@/ 18 | ln -sf $@ $(installation_symlink) 19 | 20 | $(scripts): 21 | sed 's_VEMPATH_$(installation_symlink)_' bin/$@ > $(bin_dir)/$@ 22 | chmod +x $(bin_dir)/$@ 23 | 24 | .PHONY: clean 25 | clean: 26 | -rm -f $(script_dst) $(gui_script_dst) $(installation_symlink) 27 | -rm -fr $(installation_dir) 28 | 29 | -------------------------------------------------------------------------------- /bin/gvem: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gvim -u "VEMPATH/vemrc" "$@" 3 | -------------------------------------------------------------------------------- /bin/nvem: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | nvim -u "VEMPATH/vemrc" "$@" 3 | 4 | -------------------------------------------------------------------------------- /bin/vem: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | vim -u "VEMPATH/vemrc" "$@" 3 | 4 | -------------------------------------------------------------------------------- /doc/img/vem-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/doc/img/vem-logo.png -------------------------------------------------------------------------------- /doc/img/vem-main-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/doc/img/vem-main-screenshot.png -------------------------------------------------------------------------------- /plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/.gitkeep -------------------------------------------------------------------------------- /plugins/CamelCaseMotion/.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /plugins/CamelCaseMotion/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/bkad/CamelCaseMotion.git 8 | branch = master 9 | commit = de439d7c06cffd0839a29045a103fe4b44b15cdc 10 | parent = 197aeba6bdacb8dec2f315ebc8c55c8502264af1 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /plugins/CamelCaseMotion/CHANGES.md: -------------------------------------------------------------------------------- 1 | 9f8c26be23e2335e20f7198a4c9d29bd24ed918f 2 | ---------------------------------------- 3 | 4 | - No longer map CamelCaseMotion to `w/e/b/ge` by default. 5 | Requires a call to `camelcasemotion#CreateMotionMappings` to bind the default mappings. 6 | -------------------------------------------------------------------------------- /plugins/ctrlp.vim/.gitignore: -------------------------------------------------------------------------------- 1 | *.markdown 2 | *.zip 3 | note.txt 4 | tags 5 | tags-cn 6 | .hg* 7 | tmp/* 8 | -------------------------------------------------------------------------------- /plugins/ctrlp.vim/autoload/ctrlp/quickfix.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================= 2 | " File: autoload/ctrlp/quickfix.vim 3 | " Description: Quickfix extension 4 | " Author: Kien Nguyen 5 | " ============================================================================= 6 | 7 | " Init {{{1 8 | if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix 9 | fini 10 | en 11 | let g:loaded_ctrlp_quickfix = 1 12 | 13 | cal add(g:ctrlp_ext_vars, { 14 | \ 'init': 'ctrlp#quickfix#init()', 15 | \ 'accept': 'ctrlp#quickfix#accept', 16 | \ 'lname': 'quickfix', 17 | \ 'sname': 'qfx', 18 | \ 'type': 'line', 19 | \ 'sort': 0, 20 | \ 'nolim': 1, 21 | \ }) 22 | 23 | let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) 24 | 25 | fu! s:lineout(dict) 26 | retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'], 27 | \ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S')) 28 | endf 29 | " Utilities {{{1 30 | fu! s:syntax() 31 | if !ctrlp#nosy() 32 | cal ctrlp#hicheck('CtrlPqfLineCol', 'Search') 33 | sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' 34 | en 35 | endf 36 | " Public {{{1 37 | fu! ctrlp#quickfix#init() 38 | cal s:syntax() 39 | retu map(getqflist(), 's:lineout(v:val)') 40 | endf 41 | 42 | fu! ctrlp#quickfix#accept(mode, str) 43 | let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|') 44 | if vals == [] || vals[1] == '' | retu | en 45 | cal ctrlp#acceptfile(a:mode, vals[1]) 46 | let cur_pos = getpos('.')[1:2] 47 | if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)') 48 | mark ' 49 | en 50 | cal cursor(vals[2], vals[3]) 51 | sil! norm! zvzz 52 | endf 53 | 54 | fu! ctrlp#quickfix#id() 55 | retu s:id 56 | endf 57 | "}}} 58 | 59 | " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 60 | -------------------------------------------------------------------------------- /plugins/matchit/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/chrisbra/matchit.git 8 | branch = master 9 | commit = 2db9c041a4cad58b437dab7741f05c6269c845ab 10 | parent = 027c44d91b36d2f6201ef8ccaf969274fe6aef8c 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /plugins/matchit/README.md: -------------------------------------------------------------------------------- 1 | # matchit [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/cb%40256bit.org) 2 | Vim matchit plugin (upstream repository) 3 | 4 | The upstream maintained matchit plugin. The original has been created and 5 | maintained by [Benji Fisher](https://github.com/benjifisher/matchit.zip), 6 | however that looks now unmaintained. 7 | 8 | Once in a while, a snapshot from here will be send to Bram for inclusion and 9 | distribution with [Vim][1] 10 | 11 | ### Installation 12 | The plugin is distributed as package and should be cloned below `pack/dist/opt` 13 | in your runtime path (e.g. `~/.vim/pack/dist/opt/matchit`). Then it can be 14 | activated in your .vimrc using the command: 15 | 16 | :packadd! matchit 17 | 18 | ### Documentation 19 | 20 | - The latest matchit documentation is available here 21 | [doc/matchit.txt](https://github.com/chrisbra/matchit/blob/master/doc/matchit.txt) 22 | - The matchit documentation distributed with Vim is available at 23 | [:h matchit](https://github.com/vim/vim/blob/master/runtime/pack/dist/opt/matchit/doc/matchit.txt) 24 | (The help command only works after the plugin has been activated using the `:packadd` command) 25 | 26 | ### License & Copyright 27 | 28 | The Vim license (see `:h license`) applies to the Vim plugin. 29 | 30 | __NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK__ 31 | 32 | [1]: https://www.github.com/vim/vim 33 | -------------------------------------------------------------------------------- /plugins/nerdcommenter/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.swp 3 | tags 4 | -------------------------------------------------------------------------------- /plugins/vem-dark/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = git@github.com:pacha/vem-dark.git 8 | branch = master 9 | commit = d0f7ceeabf078f962c74dcd9d65f83a7b57bba75 10 | parent = 94afe6a659fd715a993d4a1573307823908adfc2 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /plugins/vem-dark/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andrés Sopeña 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugins/vem-dark/screenshots/vem-dark-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-dark/screenshots/vem-dark-16.png -------------------------------------------------------------------------------- /plugins/vem-dark/screenshots/vem-dark-24bit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-dark/screenshots/vem-dark-24bit.png -------------------------------------------------------------------------------- /plugins/vem-dark/screenshots/vem-dark-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-dark/screenshots/vem-dark-256.png -------------------------------------------------------------------------------- /plugins/vem-dark/screenshots/vem-dark-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-dark/screenshots/vem-dark-example.png -------------------------------------------------------------------------------- /plugins/vem-dark/screenshots/vem-dark-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-dark/screenshots/vem-dark-gui.png -------------------------------------------------------------------------------- /plugins/vem-statusline/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andrés Sopeña 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugins/vem-statusline/autoload/vem_statusline/filename_format.vim: -------------------------------------------------------------------------------- 1 | 2 | " Return the root directory of the project that contains 'filename'. The root 3 | " is detected by the presence of a file or directory named as the passed 4 | " parameter 'project_marker' 5 | function! vem_statusline#filename_format#get_project_root(filename, project_marker) 6 | let path = fnamemodify(a:filename, ':p:h') 7 | let prev_path = '' 8 | while path !=# prev_path 9 | let marker_path = path . '/' . a:project_marker 10 | let type = getftype(marker_path) 11 | if type != '' 12 | return path 13 | endif 14 | let prev_path = path 15 | let path = fnamemodify(path, ':h') 16 | endwhile 17 | return '' 18 | endfunction 19 | 20 | " Return the name of the current file relative to the project root 21 | function! vem_statusline#filename_format#get_name_relative_to_project_root() 22 | let current_filename = expand('%:p') 23 | let project_marker = g:vem_statusline_project_marker 24 | let project_dir = vem_statusline#filename_format#get_project_root(current_filename, project_marker) 25 | if project_dir != '' 26 | let relative_filename = current_filename[len(project_dir) + 1:] 27 | return relative_filename 28 | else 29 | return expand('%:.') 30 | endif 31 | endfunction 32 | 33 | -------------------------------------------------------------------------------- /plugins/vem-statusline/doc/images/vem-statusline-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-statusline/doc/images/vem-statusline-dark.png -------------------------------------------------------------------------------- /plugins/vem-statusline/doc/images/vem-statusline-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-statusline/doc/images/vem-statusline-light.png -------------------------------------------------------------------------------- /plugins/vem-statusline/plugin/vem_statusline.vim: -------------------------------------------------------------------------------- 1 | " Vem Statusline. A lightweight statusline for Vim. 2 | " Part of the Vem project 3 | " Maintainer: Andrés Sopeña 4 | " Licence: The MIT License (MIT) 5 | 6 | " Sentinel to prevent double execution 7 | if exists('g:loaded_vem_statusline') 8 | finish 9 | endif 10 | let g:loaded_vem_statusline = 1 11 | 12 | scriptencoding utf-8 13 | 14 | " Configuration variables 15 | let g:vem_statusline_parts = get(g:, 'vem_statusline_parts', 'mbfienpP') 16 | let g:vem_statusline_filename_format = get(g:, 'vem_statusline_filename_format', 'P') 17 | let g:vem_statusline_project_marker = get(g:, 'vem_statusline_project_marker', '.git') 18 | let g:vem_statusline_branch_function = get(g:, 'vem_statusline_branch_function', '') 19 | let g:vem_statusline_mode_separator = get(g:, 'vem_statusline_mode_separator', ' ~ ') 20 | let g:vem_statusline_branch_separator = get(g:, 'vem_statusline_branch_separator', ':') 21 | let g:vem_statusline_right_separator = get(g:, 'vem_statusline_right_separator', '|') 22 | let g:vem_unnamed_buffer_label = get(g:, 'vem_unnamed_buffer_label', '[No Name]') 23 | 24 | " Syntax highlighting 25 | highlight default link VemStatusLineSeparator StatusLine 26 | highlight default link VemStatusLineMode StatusLine 27 | highlight default link VemStatusLineModeInsert StatusLine 28 | highlight default link VemStatusLineBranch StatusLine 29 | highlight default link VemStatusLineFileModified StatusLine 30 | highlight default link VemStatusLineFileRO StatusLine 31 | highlight default link VemStatusLinePosition StatusLine 32 | 33 | " Configure statusline 34 | set statusline=%!vem_statusline#render() 35 | 36 | -------------------------------------------------------------------------------- /plugins/vem-tabline/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = /home/pacha/code/vem-tabline 8 | branch = dev 9 | commit = 6a0927678f918ab6ebd5c5856a27d722a2593d5b 10 | parent = f38a96d3fa37c26ca52ed560739fad2d2abf068f 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /plugins/vem-tabline/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andrés Sopeña 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugins/vem-tabline/autoload/vem_tabline/separator.vim: -------------------------------------------------------------------------------- 1 | " Vem Tabline: separator 2 | 3 | " Due to a bug in Vim dictionary functions don't trigger script autoload 4 | " This is just a workaround to load the files 5 | function! vem_tabline#separator#Init() abort 6 | return 1 7 | endfunction 8 | 9 | let vem_tabline#separator#section = {} 10 | let vem_tabline#separator#section.label = '' 11 | let vem_tabline#separator#section.extra_buffer_count = 0 12 | 13 | " Update state of the section 14 | function! vem_tabline#separator#section.update(extra_buffer_count) abort 15 | let self.extra_buffer_count = a:extra_buffer_count 16 | if self.extra_buffer_count != 0 17 | let self.label = ' +' . self.extra_buffer_count . ' more ' 18 | else 19 | let self.label = '' 20 | endif 21 | endfunction 22 | 23 | " Calculate the length in characters of the section 24 | function! vem_tabline#separator#section.get_length() abort 25 | return len(self.label) 26 | endfunction 27 | 28 | " Render the '+ more' buffers indicator 29 | function! vem_tabline#separator#section.render() abort 30 | if self.extra_buffer_count != 0 31 | return '%#VemTablineSeparator#' . self.label . '%=' 32 | else 33 | return '%#VemTablineNormal#%=' 34 | endif 35 | endfunction 36 | 37 | -------------------------------------------------------------------------------- /plugins/vem-tabline/autoload/vem_tabline/tabpages.vim: -------------------------------------------------------------------------------- 1 | " Vem Tabline: tabpages 2 | 3 | " Due to a bug in Vim dictionary functions don't trigger script autoload 4 | " This is just a workaround to load the files 5 | function! vem_tabline#tabpages#Init() abort 6 | return 1 7 | endfunction 8 | 9 | let vem_tabline#tabpages#section = {} 10 | let vem_tabline#tabpages#section.tabpage_count = 0 11 | 12 | " Update state of the section 13 | function! vem_tabline#tabpages#section.update() abort 14 | let self.tabpage_count = tabpagenr('$') 15 | endfunction 16 | 17 | " Calculate the length in characters of the section 18 | " It considers each tab to consist of the number itself and two blank 19 | " characters at the sides. eg ' 12 '. Only works up to 999 tabs. 20 | function! vem_tabline#tabpages#section.get_length() abort 21 | if self.tabpage_count == 1 22 | return 0 23 | elseif self.tabpage_count < 10 24 | return self.tabpage_count * 3 25 | elseif self.tabpage_count < 100 26 | return (self.tabpage_count - 9) * 4 + (9 * 3) 27 | else 28 | return (self.tabpage_count - 90) * 5 + (self.tabpage_count - 9) * 4 + (9 * 3) 29 | endif 30 | endfunction 31 | 32 | " render the tabpage list 33 | function! vem_tabline#tabpages#section.render() abort 34 | 35 | if self.tabpage_count == 1 36 | return '' 37 | endif 38 | 39 | let section = '' 40 | for tabpage_nr in range(1, self.tabpage_count) 41 | 42 | " select the highlighting 43 | if tabpage_nr == tabpagenr() 44 | let section .= '%#VemTablineTabSelected#' 45 | else 46 | let section .= '%#VemTablineTabNormal#' 47 | endif 48 | 49 | " set the tab page number (for mouse clicks) and label 50 | let section .= '%' . tabpage_nr . 'T ' . tabpage_nr . ' ' 51 | endfor 52 | 53 | " after the last tab reset tab page number 54 | let section .= '%T' 55 | 56 | return section 57 | 58 | endfunction 59 | 60 | -------------------------------------------------------------------------------- /plugins/vem-tabline/doc/screenshots/color-scheme-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-tabline/doc/screenshots/color-scheme-example.png -------------------------------------------------------------------------------- /plugins/vem-tabline/doc/screenshots/one-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vem-tabline/doc/screenshots/one-window.png -------------------------------------------------------------------------------- /plugins/vim-EnhancedJumps/.gitignore: -------------------------------------------------------------------------------- 1 | *.msgout 2 | *.msgresult 3 | *.out 4 | *.tap 5 | doc/*.description 6 | doc/*.install 7 | tags 8 | -------------------------------------------------------------------------------- /plugins/vim-EnhancedJumps/EnhancedJumps.manifest: -------------------------------------------------------------------------------- 1 | autoload/EnhancedJumps/Common.vim 2 | autoload/EnhancedJumps/Changes.vim 3 | autoload/EnhancedJumps.vim 4 | plugin/EnhancedJumps.vim 5 | doc/EnhancedJumps.txt 6 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/.gitignore: -------------------------------------------------------------------------------- 1 | *.msgout 2 | *.out 3 | *.tap 4 | doc/*.description 5 | doc/*.install 6 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/area.vim: -------------------------------------------------------------------------------- 1 | " ingo/area.vim: Functions to deal with areas. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#area#IsEmpty( area ) 11 | if empty(a:area) 12 | return 1 13 | elseif a:area[0][0] == 0 || a:area[1][0] == 0 14 | return 1 15 | elseif a:area[0] == a:area[1] 16 | return 1 17 | endif 18 | return 0 19 | endfunction 20 | 21 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 22 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/cmdrange.vim: -------------------------------------------------------------------------------- 1 | " ingo/cmdrange.vim: Functions for working with command ranges. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2019 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | let s:save_cpo = &cpo 10 | set cpo&vim 11 | 12 | function! ingo#cmdrange#FromCount( ... ) 13 | "****************************************************************************** 14 | "* PURPOSE: 15 | " Convert the passed a:count / v:count into a command-line range, defaulting 16 | " to the current line / a:defaultRange if count is 0. 17 | "* ASSUMPTIONS / PRECONDITIONS: 18 | " None. 19 | "* EFFECTS / POSTCONDITIONS: 20 | " None. 21 | "* INPUTS: 22 | " a:defaultRange Optional default range when count is 0. 23 | " a:count Optional given count. 24 | "* RETURN VALUES: 25 | " Command-line range to be prepended to an Ex command. 26 | "****************************************************************************** 27 | let l:defaultRange = (a:0 && a:1 isnot# '' ? a:1 : '.') 28 | let l:count = (a:0 >= 2 ? a:2 : v:count) 29 | return (l:count ? 30 | \ (l:count == 1 ? '.' : '.,.+' . (l:count - 1)) : 31 | \ l:defaultRange 32 | \) 33 | endfunction 34 | 35 | let &cpo = s:save_cpo 36 | unlet s:save_cpo 37 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 38 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/collections/permute.vim: -------------------------------------------------------------------------------- 1 | " ingo/collections/permute.vim: Functions to permute a List. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2014 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.021.001 27-Jun-2014 file creation 12 | 13 | function! ingo#collections#permute#Shuffle( list, Rand ) 14 | " Fisher-Yates shuffle 15 | let [l:list, l:len] = [a:list, len(a:list)] 16 | 17 | let i = l:len 18 | while i > 0 19 | let i -= 1 20 | let j = a:Rand() * i % l:len 21 | if i == j 22 | continue 23 | endif 24 | let l:swap = l:list[i] 25 | let l:list[i] = list[j] 26 | let l:list[j] = l:swap 27 | endwhile 28 | 29 | return l:list 30 | endfunction 31 | 32 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 33 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/collections/recursive.vim: -------------------------------------------------------------------------------- 1 | " ingo/collections/recursive.vim: Recursively map a data structure. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2019 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#collections#recursive#map( expr1, expr2 ) 11 | return s:Map(0, a:expr1, a:expr2) 12 | endfunction 13 | function! ingo#collections#recursive#MapWithCopy( expr1, expr2 ) 14 | return s:Map(1, copy(a:expr1), a:expr2) 15 | endfunction 16 | function! s:Map( isCopy, expr1, expr2 ) 17 | return map(a:expr1, 's:RecursiveMap(a:isCopy, v:val, a:expr2)') 18 | endfunction 19 | function! s:RecursiveMap( isCopy, value, expr2 ) 20 | let l:value = (a:isCopy ? copy(a:value) : a:value) 21 | 22 | if type(a:value) == type([]) || type(a:value) == type({}) 23 | return s:Map(a:isCopy, l:value, a:expr2) 24 | else 25 | return map([l:value], a:expr2)[0] 26 | endif 27 | endfunction 28 | 29 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 30 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/collections/rotate.vim: -------------------------------------------------------------------------------- 1 | " ingo/collections/rotate.vim: Functions to rotate items in a List. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.006.001 25-May-2013 file creation 12 | 13 | function! ingo#collections#rotate#Right( list ) 14 | return insert(a:list, remove(a:list, -1)) 15 | endfunction 16 | function! ingo#collections#rotate#Left( list ) 17 | return add(a:list, remove(a:list, 0)) 18 | endfunction 19 | 20 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 21 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/compat/command.vim: -------------------------------------------------------------------------------- 1 | " ingo/compat/command.vim: Compatibility functions for commands. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.030.001 20-Feb-2017 file creation 12 | 13 | function! ingo#compat#command#Mods( mods ) 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " Return the command modifiers || passed in raw as a:mods. 17 | " In order to support older Vim versions that don't have this, one cannot use 18 | " ; this isn't understood and raises an error. Instead, we can benefit 19 | " from the fact that the modifiers do not contain special characters, and do 20 | " the quoting ourselves: ''. Now we only need to remove the identifer in 21 | " case it hasn't been understood, and this is what this function is about. 22 | " -command! Sedit call SpecialEdit() 23 | " +command! Sedit call SpecialEdit(ingo#compat#command#Mods('')) 24 | "* ASSUMPTIONS / PRECONDITIONS: 25 | " None. 26 | "* EFFECTS / POSTCONDITIONS: 27 | " None. 28 | "* INPUTS: 29 | " '' 30 | "* RETURN VALUES: 31 | " Usable modifiers. 32 | "****************************************************************************** 33 | return (a:mods ==# '' ? '' : a:mods) 34 | endfunction 35 | 36 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 37 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/compat/regexp.vim: -------------------------------------------------------------------------------- 1 | " ingo/compat/regexp.vim: Functions for regular expression compatibility. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2015 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.024.001 20-Feb-2015 file creation 12 | 13 | if exists('+regexpengine') " {{{2 14 | " XXX: The new NFA-based regexp engine has a problem with non-greedy \s\{-} 15 | " match together with the branches where only one is anchored; cp. 16 | " http://article.gmane.org/gmane.editors.vim.devel/43712 17 | " XXX: The new NFA-based regexp engine has a problem with the /\@<= pattern 18 | " in combination with a back reference \1; cp. 19 | " http://article.gmane.org/gmane.editors.vim.devel/46596 20 | function! ingo#compat#regexp#GetOldEnginePrefix() 21 | return '\%#=1' 22 | endfunction 23 | else 24 | function! ingo#compat#regexp#GetOldEnginePrefix() 25 | return '' 26 | endfunction 27 | endif 28 | 29 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 30 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/compat/window.vim: -------------------------------------------------------------------------------- 1 | " ingo/compat/window.vim: Compatibility functions for windows. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2016 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.028.001 10-Oct-2016 file creation 12 | 13 | if exists('*getcmdwintype') 14 | function! ingo#compat#window#IsCmdlineWindow() 15 | return ! empty(getcmdwintype()) 16 | endfunction 17 | elseif v:version >= 702 18 | function! ingo#compat#window#IsCmdlineWindow() 19 | return bufname('') ==# '[Command Line]' 20 | endfunction 21 | else 22 | function! ingo#compat#window#IsCmdlineWindow() 23 | return bufname('') ==# 'command-line' 24 | endfunction 25 | endif 26 | 27 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 28 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/dict/count.vim: -------------------------------------------------------------------------------- 1 | " ingo/dict/count.vim: Functions for counting with Dictionaries. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/collections.vim autoload script 5 | " - ingo/dict.vim autoload script 6 | " 7 | " Copyright: (C) 2017 Ingo Karkat 8 | " The VIM LICENSE applies to this script; see ':help copyright'. 9 | " 10 | " Maintainer: Ingo Karkat 11 | " 12 | " REVISION DATE REMARKS 13 | " 001 24-May-2017 file creation 14 | 15 | function! ingo#dict#count#Items( dict, items, ... ) 16 | "****************************************************************************** 17 | "* PURPOSE: 18 | " For each item in a:items, create a key with count 1 / increment the value of 19 | " an existing key in a:dict. 20 | "* ASSUMPTIONS / PRECONDITIONS: 21 | " None. 22 | "* EFFECTS / POSTCONDITIONS: 23 | " None. 24 | "* INPUTS: 25 | " a:dict Dictionary that holds the items -> counts. Need not be empty. 26 | " a:items List of items to be counted. 27 | " a:emptyValue Optional value for items in a:list that yield an empty 28 | " string, which (in Vim versions prior to 7.4.1707) cannot be 29 | " used as a Dictionary key. 30 | " If omitted, empty values are not included in the Dictionary. 31 | "* RETURN VALUES: 32 | " a:dict 33 | "* SEE ALSO: 34 | " ingo#collections#ToDict() does not count, just uses a hard-coded value 35 | " ingo#dict#FromKeys() also does not count but allows to specify a default value 36 | "****************************************************************************** 37 | for l:item in a:items 38 | if l:item ==# '' 39 | if a:0 40 | let l:item = a:1 41 | else 42 | continue 43 | endif 44 | endif 45 | 46 | if has_key(a:dict, l:item) 47 | let a:dict[l:item] += 1 48 | else 49 | let a:dict[l:item] = 1 50 | endif 51 | endfor 52 | return a:dict 53 | endfunction 54 | 55 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 56 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/encoding.vim: -------------------------------------------------------------------------------- 1 | " ingo/encoding.vim: Functions for dealing with character encodings. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2015 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.024.001 20-Feb-2015 file creation 12 | 13 | function! ingo#encoding#GetFileEncoding() 14 | return (empty(&l:fileencoding) ? &encoding : &l:fileencoding) 15 | endfunction 16 | 17 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/escape/shellcommand.vim: -------------------------------------------------------------------------------- 1 | " ingo/escape/shellcommand.vim: Additional escapings of shell commands. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013-2014 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.016.003 21-Jan-2014 Move ingo#escape#shellcommand#shellcmdescape() 12 | " to ingo#compat#shellcommand#escape(), as it is 13 | " only required for older Vim versions. 14 | " 1.012.002 09-Aug-2013 Rename file. 15 | " 001 08-Aug-2013 file creation from escapings.vim. 16 | 17 | function! ingo#escape#shellcommand#exescape( command ) 18 | "******************************************************************************* 19 | "* PURPOSE: 20 | " Escape a shell command (potentially consisting of multiple commands and 21 | " including (already quoted) command-line arguments) so that it can be used in 22 | " Ex commands. For example: 'hostname && ps -ef | grep -e "foo"'. 23 | " 24 | "* ASSUMPTIONS / PRECONDITIONS: 25 | " ? List of any external variable, control, or other element whose state affects this procedure. 26 | "* EFFECTS / POSTCONDITIONS: 27 | " ? List of the procedure's effect on each external variable, control, or other element. 28 | "* INPUTS: 29 | " a:command Shell command-line. 30 | " 31 | "* RETURN VALUES: 32 | " Escaped shell command to be passed to the !{cmd} or :r !{cmd} commands. 33 | "******************************************************************************* 34 | if exists('*fnameescape') 35 | return join(map(split(a:command, ' '), 'fnameescape(v:val)'), ' ') 36 | else 37 | return escape(a:command, '\%#|' ) 38 | endif 39 | endfunction 40 | 41 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 42 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/event.vim: -------------------------------------------------------------------------------- 1 | " ingo/event.vim: Functions for triggering events. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2015-2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | if v:version == 703 && has('patch438') || v:version > 703 11 | function! ingo#event#Trigger( arguments ) 12 | execute 'doautocmd ' a:arguments 13 | endfunction 14 | function! ingo#event#TriggerEverywhere( arguments ) 15 | execute 'doautoall ' a:arguments 16 | endfunction 17 | else 18 | function! ingo#event#Trigger( arguments ) 19 | let l:save_modeline = &l:modeline 20 | setlocal nomodeline 21 | try 22 | execute 'doautocmd ' a:arguments 23 | finally 24 | let &l:modeline = l:save_modeline 25 | endtry 26 | endfunction 27 | function! ingo#event#TriggerEverywhere( arguments ) 28 | let l:save_modeline = &l:modeline 29 | setlocal nomodeline 30 | try 31 | execute 'doautoall ' a:arguments 32 | finally 33 | let &l:modeline = l:save_modeline 34 | endtry 35 | endfunction 36 | endif 37 | 38 | function! ingo#event#TriggerCustom( eventName ) 39 | silent call ingo#event#Trigger('User ' . a:eventName) 40 | endfunction 41 | function! ingo#event#TriggerEverywhereCustom( eventName ) 42 | silent call ingo#event#TriggerEverywhere('User ' . a:eventName) 43 | endfunction 44 | 45 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 46 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/external.vim: -------------------------------------------------------------------------------- 1 | " ingo/external.vim: Functions to launch an external Vim instance. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/compat.vim autoload script 5 | " - ingo/os.vim autoload script 6 | " 7 | " Copyright: (C) 2013 Ingo Karkat 8 | " The VIM LICENSE applies to this script; see ':help copyright'. 9 | " 10 | " Maintainer: Ingo Karkat 11 | " 12 | " REVISION DATE REMARKS 13 | " 1.013.005 13-Sep-2013 Use operating system detection functions from 14 | " ingo/os.vim. 15 | " 1.012.004 08-Aug-2013 Move escapings.vim into ingo-library. 16 | " 1.004.003 09-Apr-2013 FIX: "E117: Unknown function: s:externalLaunch". 17 | " 1.002.002 25-Feb-2013 ENH: Allow to specify filespec of GVIM 18 | " executable. 19 | " 1.000.001 28-Jan-2013 file creation from DropQuery.vim 20 | 21 | let s:externalLaunch = (ingo#os#IsWindows() ? 'silent !start' : 'silent !') 22 | function! ingo#external#LaunchGvim( commands, ... ) 23 | execute s:externalLaunch . ' ' . (a:0 ? a:1 : 'gvim') join(map(a:commands, '"-c " . ingo#compat#shellescape(v:val, 1)')) 24 | endfunction 25 | 26 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 27 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/filetype.vim: -------------------------------------------------------------------------------- 1 | " ingo/filetype.vim: Functions for the buffer's filetype(s). 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/list.vim autoload script 5 | 6 | " Copyright: (C) 2012-2017 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | 11 | function! ingo#filetype#Is( filetypes ) 12 | for l:ft in split(&filetype, '\.') 13 | if (index(ingo#list#Make(a:filetypes), l:ft) != -1) 14 | return 1 15 | endif 16 | endfor 17 | 18 | return 0 19 | endfunction 20 | 21 | function! ingo#filetype#GetPrimary( ... ) 22 | return get(split((a:0 ? a:1 : &filetype), '\.'), 0, '') 23 | endfunction 24 | function! ingo#filetype#IsPrimary( filetypes ) 25 | return (index(ingo#list#Make(a:filetypes), ingo#filetype#GetPrimary()) != -1) 26 | endfunction 27 | 28 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 29 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/folds/persistence.vim: -------------------------------------------------------------------------------- 1 | " ingo/folds/persistence.vim: Functions to persist and restore manual folds. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/compat.vim autoload script 5 | " 6 | " Copyright: (C) 2015 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | " 11 | " REVISION DATE REMARKS 12 | " 1.023.001 01-Jan-2015 file creation 13 | 14 | function! ingo#folds#persistence#SaveManualFolds() 15 | if &foldmethod !=# 'manual' 16 | return '' 17 | endif 18 | 19 | let l:filespec = tempname() 20 | let l:save_viewoptions = &viewoptions 21 | set viewoptions=folds 22 | try 23 | execute 'mkview' ingo#compat#fnameescape(l:filespec) 24 | return l:filespec 25 | finally 26 | let &viewoptions = l:save_viewoptions 27 | endtry 28 | 29 | return '' 30 | endfunction 31 | function! ingo#folds#persistence#RestoreManualFolds( handle ) 32 | if empty(a:handle) 33 | return 34 | endif 35 | 36 | silent! execute 'source' ingo#compat#fnameescape(a:handle) 37 | endfunction 38 | 39 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 40 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/foldtext.vim: -------------------------------------------------------------------------------- 1 | " ingo/foldtext.vim: Functions for creating a custom foldtext. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.014.001 19-Sep-2013 file creation 12 | 13 | function! ingo#foldtext#DefaultPrefix( text ) 14 | let l:num = v:foldend - v:foldstart + 1 15 | return printf("+-%s %2d line%s%s%s", v:folddashes, l:num, (l:num == 1 ? '' : 's'), (empty(a:text) ? '' : ': '), a:text) 16 | endfunction 17 | 18 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/ftplugin/setting.vim: -------------------------------------------------------------------------------- 1 | " ingo/ftplugin/setting.vim: Functions for filetype plugin settings in a buffer-local Dict. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! s:GetOption( variableName ) 11 | return 'b:' . a:variableName 12 | endfunction 13 | 14 | function! ingo#ftplugin#setting#Get( variableName, key, default ) 15 | let l:option = s:GetOption(a:variableName) 16 | if ! exists(l:option) 17 | return a:default 18 | endif 19 | execute 'return get(' . l:option . ', a:key, a:default)' 20 | endfunction 21 | 22 | function! ingo#ftplugin#setting#Set( variableName, key, value ) 23 | let l:option = s:GetOption(a:variableName) 24 | if ! exists(l:option) 25 | execute 'let' l:option '= {}' 26 | endif 27 | 28 | execute 'let' l:option . '[a:key] = a:value' 29 | endfunction 30 | 31 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 32 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/funcref.vim: -------------------------------------------------------------------------------- 1 | " ingo/funcref.vim: Functions for handling Funcrefs. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013-2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#funcref#ToString( Funcref ) 11 | let l:functionName = matchstr(string(a:Funcref), "^function('\\zs.*\\ze')$") 12 | return (empty(l:functionName) ? '' . a:Funcref : l:functionName) 13 | endfunction 14 | 15 | function! ingo#funcref#AsString( Funcref ) 16 | return (type(a:Funcref) == 2 ? string(a:Funcref) : a:Funcref) 17 | endfunction 18 | 19 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 20 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/gui/position.vim: -------------------------------------------------------------------------------- 1 | " ingo/gui/position.vim: Functions for the GVIM position and size. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.011.001 19-Jul-2013 file creation 12 | 13 | function! ingo#gui#position#Get() 14 | redir => l:winpos 15 | silent! winpos 16 | redir END 17 | return [&lines, &columns, matchstr(l:winpos, '\CX \zs-\?\d\+'), matchstr(l:winpos, '\CY \zs-\?\d\+')] 18 | endfunction 19 | 20 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 21 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/hlgroup.vim: -------------------------------------------------------------------------------- 1 | " ingo/hlgroup.vim: Functions around highlight groups. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.030.001 09-Feb-2017 file creation 12 | 13 | function! ingo#hlgroup#LinksTo( name ) 14 | redir => l:highlightOutput 15 | silent! execute 'highlight' a:name 16 | redir END 17 | redraw " This is necessary because of the :redir done earlier. 18 | let l:linkedGroup = matchstr(l:highlightOutput, ' xxx links to \zs.*$') 19 | return l:linkedGroup 20 | endfunction 21 | 22 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 23 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/indent.vim: -------------------------------------------------------------------------------- 1 | " ingo/indent.vim: Functions for working with indent. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2016 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.029.002 02-Dec-2016 Add ingo#indent#Split(), a simpler version of 12 | " ingo#comments#SplitIndentAndText(). 13 | " 1.028.001 25-Nov-2016 file creation 14 | 15 | function! ingo#indent#RangeSeveralTimes( firstLnum, lastLnum, command, times ) 16 | for l:i in range(a:times) 17 | silent execute a:firstLnum . ',' . a:lastLnum . a:command 18 | endfor 19 | endfunction 20 | 21 | function! ingo#indent#GetIndent( lnum ) 22 | return matchstr(getline(a:lnum), '^\s*') 23 | endfunction 24 | function! ingo#indent#GetIndentLevel( lnum ) 25 | return indent(a:lnum) / &l:shiftwidth 26 | endfunction 27 | function! ingo#indent#Split( lnum ) 28 | "****************************************************************************** 29 | "* PURPOSE: 30 | " Split the line into any leading indent, and the text after it. 31 | "* SEE ALSO: 32 | " ingo#comments#SplitIndentAndText() also considers any comment prefix as part 33 | " of the indent. 34 | "* ASSUMPTIONS / PRECONDITIONS: 35 | " None. 36 | "* EFFECTS / POSTCONDITIONS: 37 | " None. 38 | "* INPUTS: 39 | " a:lnum Number of the line to be split. 40 | "* RETURN VALUES: 41 | " Returns [a:indent, a:text]. 42 | "****************************************************************************** 43 | return matchlist(getline(a:lnum), '^\(\s*\)\(.*\)$')[1:2] 44 | endfunction 45 | 46 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 47 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/line/replace.vim: -------------------------------------------------------------------------------- 1 | " ingo/line/replace.vim: Functions to replace text in a single line. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2016 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.029.001 22-Dec-2016 file creation 12 | 13 | function! ingo#line#replace#Substitute( lnum, pat, sub, flags ) 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " Substitute a pattern in a single line in the current buffer. Low-level 17 | " alternative to :substitute without the need to suppress messages, undo 18 | " search history clobbering, cursor move. 19 | "* SEE ALSO: 20 | " - ingo#lines#replace#Substitute() handles multiple lines, but is more 21 | " costly. 22 | "* ASSUMPTIONS / PRECONDITIONS: 23 | " Does not handle inserted newlines; i.e. no additional lines will be created, 24 | " the newline will be persisted as-is (^@). 25 | "* EFFECTS / POSTCONDITIONS: 26 | " Updates a:lnum. 27 | "* INPUTS: 28 | " a:lnum Existing line number. 29 | " a:pat Regular expression to match. 30 | " a:sub Replacement string. 31 | " a:flags "g" for global replacement. 32 | "* RETURN VALUES: 33 | " If this succeeds, 0 is returned. If this fails (most likely because a:lnum is 34 | " invalid) 1 is returned. 35 | "****************************************************************************** 36 | return setline(a:lnum, substitute(getline(a:lnum), a:pat, a:sub, a:flags)) 37 | endfunction 38 | 39 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 40 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/lines/empty.vim: -------------------------------------------------------------------------------- 1 | " ingo/lines/empty.vim: Functions to search for empty lines. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#lines#empty#IsEmptyLine( lnum ) 11 | return empty(getline(a:lnum)) 12 | endfunction 13 | function! ingo#lines#empty#IsEmptyLines( lnum1, lnum2 ) 14 | return len(filter(getline(a:lnum1, a:lnum2), '! empty(v:val)')) == 0 15 | endfunction 16 | 17 | function! ingo#lines#empty#GetNextNonEmptyLnum( lnum ) 18 | let l:lnum = (a:lnum < 0 ? line('$') + a:lnum + 2 : a:lnum) + 1 19 | while l:lnum <= line('$') 20 | if ingo#lines#empty#IsEmptyLine(l:lnum) 21 | let l:lnum += 1 22 | else 23 | return l:lnum 24 | endif 25 | endwhile 26 | return 0 27 | endfunction 28 | function! ingo#lines#empty#GetPreviousNonEmptyLnum( lnum ) 29 | let l:lnum = (a:lnum < 0 ? line('$') + a:lnum + 2 : a:lnum) - 1 30 | while l:lnum >= 1 31 | if ingo#lines#empty#IsEmptyLine(l:lnum) 32 | let l:lnum -= 1 33 | else 34 | return l:lnum 35 | endif 36 | endwhile 37 | return 0 38 | endfunction 39 | 40 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 41 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/lists.vim: -------------------------------------------------------------------------------- 1 | " ingo/lists.vim: Functions to compare Lists. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#lists#StartsWith( list, sublist, ... ) 11 | if len(a:list) < len(a:sublist) 12 | return 0 13 | elseif len(a:sublist) == 0 14 | return 1 15 | endif 16 | 17 | let l:ignorecase = (a:0 && a:1) 18 | if l:ignorecase 19 | return (a:list[0 : len(a:sublist) - 1] ==? a:sublist) 20 | else 21 | return (a:list[0 : len(a:sublist) - 1] ==# a:sublist) 22 | endif 23 | endfunction 24 | 25 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 26 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/lists/find.vim: -------------------------------------------------------------------------------- 1 | " ingo/lists/find.vim: Functions for comparing Lists. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#lists#find#FirstDifferent( list1, list2 ) 11 | "****************************************************************************** 12 | "* PURPOSE: 13 | " Compare elements in a:list1 and a:list2 and return the index of the first 14 | " elements that are not equal. 15 | "* ASSUMPTIONS / PRECONDITIONS: 16 | " None. 17 | "* EFFECTS / POSTCONDITIONS: 18 | " None. 19 | "* INPUTS: 20 | " a:list1 A list. 21 | " a:list2 Another list. 22 | "* RETURN VALUES: 23 | " Index of the first element not equal / not existing in one of the lists. 24 | " -1 if both lists are identical; i.e. have the same number of elements and 25 | " all elements are equal.. 26 | "****************************************************************************** 27 | let l:i = 0 28 | while l:i < len(a:list1) 29 | if l:i >= len(a:list2) 30 | return l:i 31 | elseif a:list1[l:i] != a:list2[l:i] 32 | return l:i 33 | endif 34 | 35 | let l:i += 1 36 | endwhile 37 | return -1 38 | endfunction 39 | 40 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 41 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/lnum.vim: -------------------------------------------------------------------------------- 1 | " ingo/lnum.vim: Functions to work with line numbers. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#lnum#AddOffsetWithWrapping( lnum, offset, ... ) 11 | "****************************************************************************** 12 | "* PURPOSE: 13 | " Add a:offset to a:lnum; if the result is less than 1 or larger than 14 | " a:maxLnum, wrap around. 15 | "* ASSUMPTIONS / PRECONDITIONS: 16 | " None. 17 | "* EFFECTS / POSTCONDITIONS: 18 | " None. 19 | "* INPUTS: 20 | " a:lnum Source line number. 21 | " a:offset Positive or negative offset to apply to a:lnum. 22 | " a:maxLnum Maximum allowed line number; defaults to line('$'), the last 23 | " line of the current buffer. 24 | "* RETURN VALUES: 25 | " 1 <= result <= a:maxLnum 26 | "****************************************************************************** 27 | let l:lnum = a:lnum + a:offset 28 | let l:maxLnum = (a:0 ? a:1 : line('$')) 29 | 30 | if l:lnum < 1 31 | return l:maxLnum + l:lnum % l:maxLnum 32 | elseif l:lnum > l:maxLnum 33 | return l:lnum % l:maxLnum 34 | else 35 | return l:lnum 36 | endif 37 | endfunction 38 | 39 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 40 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/math.vim: -------------------------------------------------------------------------------- 1 | " ingo/math.vim: Mathematical functions. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2016 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.029.001 27-Dec-2016 file creation 12 | 13 | "****************************************************************************** 14 | "* PURPOSE: 15 | " Return the power of a:x to the exponent a:y as a Number. 16 | "* ASSUMPTIONS / PRECONDITIONS: 17 | " None. 18 | "* EFFECTS / POSTCONDITIONS: 19 | " None. 20 | "* INPUTS: 21 | " a:x Number. 22 | " a:y Exponent. 23 | "* RETURN VALUES: 24 | " Number. 25 | "****************************************************************************** 26 | if exists('*pow') 27 | function! ingo#math#PowNr( x, y ) 28 | return float2nr(pow(a:x, a:y)) 29 | endfunction 30 | else 31 | function! ingo#math#PowNr( x, y ) 32 | let l:r = a:x 33 | for l:i in range(a:y - 1) 34 | let l:r = l:r * a:x 35 | endfor 36 | return l:r 37 | endfunction 38 | endif 39 | 40 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 41 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/motion/omap.vim: -------------------------------------------------------------------------------- 1 | " ingo/motion/omap.vim: Helper function to repeat special operator-pending mappings. 2 | " 3 | " DEPENDENCIES: 4 | " - repeat.vim (vimscript #2136) autoload script (optional) 5 | " 6 | " Copyright: (C) 2014 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | " 11 | " REVISION DATE REMARKS 12 | " 1.016.001 15-Jan-2014 file creation 13 | let s:save_cpo = &cpo 14 | set cpo&vim 15 | 16 | function! ingo#motion#omap#repeat( repeatMapping, operator, count ) 17 | if a:operator ==# 'y' && &cpoptions !~# 'y' 18 | " A yank usually doesn't repeat. 19 | return 20 | endif 21 | 22 | silent! call repeat#set(a:operator . a:repeatMapping . 23 | \ (a:operator ==# 'c' ? "\(IngoLibraryOmapRepeatReinsert)" : ''), 24 | \ a:count 25 | \) 26 | endfunction 27 | 28 | " This is for the special repeat of a "c" command, to insert the last entered 29 | " text and leave insert mode. We define a :noremap so that any user mappings do 30 | " not affect this. 31 | inoremap (IngoLibraryOmapRepeatReinsert) . 32 | 33 | let &cpo = s:save_cpo 34 | unlet s:save_cpo 35 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 36 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/number.vim: -------------------------------------------------------------------------------- 1 | " ingo/number.vim: Functions for dealing with numbers. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.005.001 12-Apr-2013 file creation 12 | 13 | function! ingo#number#DecimalStringIncrement( number, offset ) 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " Increment the decimal number in a:number by a:offset while keeping (the 17 | " width of) leading zeros. 18 | "* ASSUMPTIONS / PRECONDITIONS: 19 | " None. 20 | "* EFFECTS / POSTCONDITIONS: 21 | " None. 22 | "* INPUTS: 23 | " a:number String (or number) to be incremented. 24 | " a:offset Offset to add to a:number. 25 | "* RETURN VALUES: 26 | " Incremented number as String. 27 | "****************************************************************************** 28 | " Note: Need to use str2nr() to avoid interpreting leading zeros as octal 29 | " number. 30 | return printf('%0' . strlen(a:number) . 'd', str2nr(a:number) + a:offset) 31 | endfunction 32 | 33 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 34 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/os.vim: -------------------------------------------------------------------------------- 1 | " ingo/os.vim: Functions for operating system-specific stuff. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013-2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.030.005 21-Apr-2017 Add ingo#os#IsWindowsShell(). 12 | " 1.014.004 26-Sep-2013 Add ingo#os#IsCygwin(). 13 | " 1.014.003 13-Sep-2013 Add ingo#os#PathSeparator(). 14 | " 1.013.002 13-Sep-2013 FIX: Correct case of ingo#os#IsWin*() function 15 | " names. 16 | " 1.012.001 08-Aug-2013 file creation 17 | 18 | function! ingo#os#IsWindows() 19 | return has('win16') || has('win95') || has('win32') || has('win64') 20 | endfunction 21 | 22 | function! ingo#os#IsWinOrDos() 23 | return has('dos16') || has('dos32') || ingo#os#IsWindows() 24 | endfunction 25 | 26 | function! ingo#os#IsCygwin() 27 | return has('win32unix') 28 | endfunction 29 | 30 | function! ingo#os#PathSeparator() 31 | return (ingo#os#IsWinOrDos() ? ';' : ':') 32 | endfunction 33 | 34 | function! ingo#os#IsWindowsShell() 35 | return (&shell =~? 'cmd\.exe$') 36 | endfunction 37 | 38 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 39 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/plugin/compiler.vim: -------------------------------------------------------------------------------- 1 | " ingo/plugin/compiler.vim: Functions for compiler plugins. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2014 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.016.001 21-Jan-2014 file creation 12 | 13 | function! ingo#plugin#compiler#CompilerSet( optionname, expr ) 14 | execute 'CompilerSet' a:optionname . '=' . escape(a:expr, ' "|\') 15 | endfunction 16 | 17 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/plugin/rendered/Confirmeach.vim: -------------------------------------------------------------------------------- 1 | " ingo/plugin/rendered/Confirmeach.vim: Filter items by confirming each, as with :s///c. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/query/get.vim autoload script 5 | " 6 | " Copyright: (C) 2015-2018 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | 11 | function! ingo#plugin#rendered#Confirmeach#Filter( items ) 12 | let l:confirmedItems = [] 13 | let l:idx = 0 14 | while l:idx < len(a:items) 15 | let l:match = a:items[l:idx] 16 | 17 | echo l:match . "\t" 18 | echohl Question 19 | echon ' Use (y/n/a/q/l; to abort)?' 20 | echohl None 21 | 22 | let l:choice = ingo#query#get#Char({'isBeepOnInvalid': 0, 'validExpr': "[ynl\aq]"}) 23 | if l:choice ==# "\" 24 | return a:items 25 | elseif l:choice ==# 'q' 26 | break 27 | elseif l:choice ==# 'y' 28 | call add(l:confirmedItems, l:match) 29 | elseif l:choice ==# 'l' 30 | call add(l:confirmedItems, l:match) 31 | break 32 | elseif l:choice ==# 'a' 33 | let l:confirmedItems += a:items[l:idx : -1] 34 | break 35 | endif 36 | 37 | let l:idx += 1 38 | endwhile 39 | 40 | return l:confirmedItems 41 | endfunction 42 | 43 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 44 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/plugin/rendered/Subset.vim: -------------------------------------------------------------------------------- 1 | " ingo/plugin/rendered/Subset.vim: Filter items by List indices. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/cmdargs/pattern.vim autoload script 5 | " - ingo/list.vim autoload script 6 | " - ingo/msg.vim autoload script 7 | " 8 | " Copyright: (C) 2015-2018 Ingo Karkat 9 | " The VIM LICENSE applies to this script; see ':help copyright'. 10 | " 11 | " Maintainer: Ingo Karkat 12 | 13 | function! ingo#plugin#rendered#Subset#Filter( items ) 14 | echohl Question 15 | let l:subsets = input('Enter subsets in Vim List notation, e.g. "0 3:5 -1", or matching /pattern/ (non-matching with !/.../): ') 16 | echohl None 17 | 18 | let l:subsetsPattern = ingo#cmdargs#pattern#ParseUnescaped(l:subsets) 19 | if l:subsetsPattern !=# l:subsets 20 | return s:FilterByPattern(a:items, l:subsetsPattern, 0) 21 | elseif l:subsets[0] ==# '!' 22 | let l:subsetsPattern = ingo#cmdargs#pattern#ParseUnescaped(l:subsets[1:]) 23 | if l:subsetsPattern !=# l:subsets 24 | return s:FilterByPattern(a:items, l:subsetsPattern, 1) 25 | endif 26 | endif 27 | return s:Slice(a:items, split(l:subsets)) 28 | endfunction 29 | 30 | function! s:FilterByPattern( items, pattern, isKeepNonMatching ) 31 | return filter(a:items, printf('v:val %s~ a:pattern', a:isKeepNonMatching ? '!' : '=')) 32 | endfunction 33 | 34 | function! s:Slice( items, subsets ) 35 | try 36 | let l:subsetItems = [] 37 | for l:subset in a:subsets 38 | execute printf('let l:subsetItems += ingo#list#Make(a:items[%s])', l:subset) 39 | endfor 40 | return l:subsetItems 41 | catch /^Vim\%((\a\+)\)\=:/ 42 | redraw 43 | call ingo#msg#VimExceptionMsg() 44 | sleep 500m 45 | return ingo#plugin#rendered#Subset#Filter(a:items) 46 | endtry 47 | endfunction 48 | 49 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 50 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/print.vim: -------------------------------------------------------------------------------- 1 | " ingo/print.vim: Functions for printling lines. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/window/dimensions.vim autoload script 5 | " 6 | " Copyright: (C) 2013 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | " 11 | " REVISION DATE REMARKS 12 | " 1.015.001 22-Nov-2013 file creation 13 | 14 | function! ingo#print#Number( lnum, ... ) 15 | "****************************************************************************** 16 | "* PURPOSE: 17 | " Like :number, but does not move the cursor to the line, and only prints the 18 | " passed a:lnum, not all lines in a (potential) closed fold. 19 | "* ASSUMPTIONS / PRECONDITIONS: 20 | " None. 21 | "* EFFECTS / POSTCONDITIONS: 22 | " :echos output. 23 | "* INPUTS: 24 | " a:lnum Line number; when the line does not exist, nothing is printed. 25 | " a:hlgroup Optional highlight group for the number, default is "LineNr". 26 | "* RETURN VALUES: 27 | " 1 is line exists and was printed; 0 otherwise. 28 | "****************************************************************************** 29 | if a:lnum < 1 || a:lnum > line('$') 30 | return 0 31 | endif 32 | 33 | execute 'echohl' (a:0 ? a:1 : 'LineNr') 34 | echo printf('%' . (ingo#window#dimensions#GetNumberWidth(1) - 1) . 'd ', a:lnum) 35 | echohl None 36 | echon getline(a:lnum) 37 | endfunction 38 | 39 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 40 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/query/substitute.vim: -------------------------------------------------------------------------------- 1 | " ingo/query/substitute.vim: Functions for confirming a command like :substitute//c. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/query.vim autoload script 5 | " 6 | " Copyright: (C) 2014-2016 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | " 11 | " REVISION DATE REMARKS 12 | " 1.025.002 27-Jan-2016 Refactoring: Factor out ingo#query#Question(). 13 | " 1.017.001 04-Mar-2014 file creation 14 | 15 | function! s:Question( msg ) 16 | call ingo#query#Question(a:msg . ' (y/n/a/q/l/^E/^Y)?') 17 | endfunction 18 | function! ingo#query#substitute#Get( msg ) 19 | "****************************************************************************** 20 | "* PURPOSE: 21 | " Query a response like |:s_c|, with choices of yes, no, last, quit, Ctrl-E, 22 | " Ctrl-Y. The latter two are handled transparently by this function. 23 | "* ASSUMPTIONS / PRECONDITIONS: 24 | " None. 25 | "* EFFECTS / POSTCONDITIONS: 26 | " Moves the view on Ctrl-E / Ctrl-Y. 27 | "* INPUTS: 28 | " a:msg Message to be presented for acknowledging. 29 | "* RETURN VALUES: 30 | " One of [ynlaq\e]. 31 | "****************************************************************************** 32 | call s:Question(a:msg) 33 | 34 | while 1 35 | let l:choice = ingo#query#get#Char({'isBeepOnInvalid': 0, 'validExpr': "[ynl\aq\\]"}) 36 | if l:choice ==# "\" || l:choice ==# "\" 37 | execute 'normal!' l:choice 38 | redraw 39 | call s:Question(a:msg) 40 | elseif l:choice ==# "\" 41 | return 'q' 42 | elseif ! empty(l:choice) 43 | return l:choice 44 | endif 45 | endwhile 46 | endfunction 47 | 48 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 49 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/range/borders.vim: -------------------------------------------------------------------------------- 1 | " ingo/range/borders.vim: Functions for determining ranges at the borders of the buffer. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2016 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 001 13-Jul-2016 file creation 12 | 13 | function! ingo#range#borders#StartAndEndRange( startOffset, endOffset ) 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " Determine non-overlapping range(s) for a:startOffset lines from the start of 17 | " the current buffer, and a:endOffset lines from the end of the current 18 | " buffer. 19 | "* ASSUMPTIONS / PRECONDITIONS: 20 | " None. 21 | "* EFFECTS / POSTCONDITIONS: 22 | " None. 23 | "* INPUTS: 24 | " a:startOffset Number of lines to get from the start. 25 | " a:endOffset Number of lines to get from the end. 26 | "* RETURN VALUES: 27 | " List of ranges, in the form ['1,3', '8,$'] 28 | "****************************************************************************** 29 | let l:ranges = [] 30 | let l:lastStartLnum = min([line('$'), a:startOffset]) 31 | if a:startOffset > 0 32 | call add(l:ranges, '1,' . l:lastStartLnum) 33 | endif 34 | 35 | let l:firstEndLnum = max([1, line('$') - a:endOffset + 1]) 36 | let l:firstEndLnum = max([l:lastStartLnum + 1, l:firstEndLnum]) 37 | if l:firstEndLnum <= line('$') 38 | call add(l:ranges, l:firstEndLnum . ',$') 39 | endif 40 | return l:ranges 41 | endfunction 42 | 43 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 44 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/regexp/multi.vim: -------------------------------------------------------------------------------- 1 | " ingo/regexp/multi.vim: Functions around pattern multiplicity. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#regexp#multi#Expr() 11 | "****************************************************************************** 12 | "* PURPOSE: 13 | " REturn a regular expression that matches any multi. 14 | "* ASSUMPTIONS / PRECONDITIONS: 15 | " None. 16 | "* EFFECTS / POSTCONDITIONS: 17 | " None. 18 | "* INPUTS: 19 | " None. 20 | "* RETURN VALUES: 21 | " Regular expression. 22 | "****************************************************************************** 23 | return '\%(\%(^\|[^\\]\)\%(\\\\\)*\\\)\@\|=\|!\|<=\| 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.024.001 01-Apr-2015 file creation 12 | let s:save_cpo = &cpo 13 | set cpo&vim 14 | 15 | function! ingo#regexp#virtcols#ExtractCells( virtcol, width, isAllowSmaller ) 16 | "****************************************************************************** 17 | "* PURPOSE: 18 | " Assemble a regular expression that matches screen columns starting from 19 | " a:virtcol of a:width. 20 | "* ASSUMPTIONS / PRECONDITIONS: 21 | " None. 22 | "* EFFECTS / POSTCONDITIONS: 23 | " None. 24 | "* INPUTS: 25 | " a:virtcol First virtual column (first column is 1); the character must 26 | " begin exactly at that column. 27 | " a:width Width in screen columns. 28 | " a:isAllowSmaller Boolean flag whether less characters can be matched if 29 | " the end doesn't fall on a character border, or there 30 | " aren't that many characters. Else, exactly a:width 31 | " screen columns must be matched. 32 | "* RETURN VALUES: 33 | " Regular expression. 34 | "****************************************************************************** 35 | if a:virtcol < 1 36 | throw 'ExtractCells: Column must be at least 1' 37 | endif 38 | return '\%' . a:virtcol . 'v.*' . 39 | \ (a:isAllowSmaller ? 40 | \ '\%<' . (a:virtcol + a:width + 1) . 'v' : 41 | \ '\%' . (a:virtcol + a:width) . 'v' 42 | \) 43 | endfunction 44 | 45 | let &cpo = s:save_cpo 46 | unlet s:save_cpo 47 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 48 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/search/buffer.vim: -------------------------------------------------------------------------------- 1 | " ingo/search/buffer.vim: Functions for searching a buffer. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.005.001 10-Apr-2013 file creation 12 | 13 | function! ingo#search#buffer#IsKeywordMatch( text, startVirtCol ) 14 | return search( 15 | \ printf('\C\V\%%%dv\<%s\>', a:startVirtCol, escape(a:text, '\')), 16 | \ 'cnW', line('.') 17 | \) 18 | endfunction 19 | 20 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 21 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/search/pattern.vim: -------------------------------------------------------------------------------- 1 | " ingo/search/pattern.vim: Functions for the search pattern. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2011-2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.013.002 11-Sep-2013 Minor: Return last search pattern instead of 12 | " empty string on 13 | " ingo#search#pattern#GetLastForwardSearch(0). 14 | " 1.006.001 24-May-2013 file creation 15 | 16 | function! ingo#search#pattern#GetLastForwardSearch( ... ) 17 | "****************************************************************************** 18 | "* PURPOSE: 19 | " Get @/, or the a:count'th last search pattern, but also handle the case 20 | " where the pattern was set from a backward search, and doesn't have "/" 21 | " characters properly escaped. 22 | "* ASSUMPTIONS / PRECONDITIONS: 23 | " None. 24 | "* EFFECTS / POSTCONDITIONS: 25 | " None. 26 | "* INPUTS: 27 | " a:count Optional index into the end of the search history. 0 returns the 28 | " last search pattern, 1 the last from the history. (Usually, those should be 29 | " equal). 30 | "* RETURN VALUES: 31 | " Last search pattern ready to use in a :s/{pat}/ command, with forward 32 | " slashes properly escaped. 33 | "****************************************************************************** 34 | return substitute((a:0 && a:1 ? histget('search', -1 * a:1) : @/), '\%(\%(^\|[^\\]\)\%(\\\\\)*\\\)\@ 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.006.001 23-May-2013 file creation 12 | 13 | function! ingo#selection#patternmatch#AdaptEmptySelection() 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " With :set selection=exclusive, one can create an empty selection with |v| or 17 | " |CTRL-V|. The |/\%V| atom does not match anywhere then. However, (built-in) 18 | " commands like gU do work on one selected character. For consistency, custom 19 | " mappings should, too. Invoke this function at the beginning of your mapping 20 | " to adapt the selection in this special case. You can then use a pattern with 21 | " |/\%V| without worrying. 22 | "* ASSUMPTIONS / PRECONDITIONS: 23 | " A visual selection has previously been established. 24 | "* EFFECTS / POSTCONDITIONS: 25 | " Changes the visual selection. 26 | " Clobbers v:count when active. 27 | "* INPUTS: 28 | " None. 29 | "* RETURN VALUES: 30 | " None. 31 | "****************************************************************************** 32 | if &selection ==# 'exclusive' && virtcol("'<") == virtcol("'>") 33 | silent! execute "normal! gvl\" 34 | endif 35 | endfunction 36 | 37 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 38 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/str/join.vim: -------------------------------------------------------------------------------- 1 | " ingo/str/join.vim: Functions for joining lists of strings. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2015 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.024.001 24-Feb-2015 file creation 12 | 13 | function! ingo#str#join#NonEmpty( list, ... ) 14 | return call('join', [filter(a:list, '! empty(v:val)')] + a:000) 15 | endfunction 16 | 17 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/str/list.vim: -------------------------------------------------------------------------------- 1 | " ingo/str/list.vim: Functions for dealing with Strings as Lists. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2018 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#str#list#OfCharacters( string ) 11 | return split(a:string, '\zs') 12 | endfunction 13 | 14 | function! ingo#str#list#OfBytes( string ) 15 | let l:i = 0 16 | let l:len = len(a:string) 17 | let l:list = [] 18 | while l:i < l:len 19 | call add(l:list, a:string[l:i]) 20 | let l:i += 1 21 | endwhile 22 | 23 | return l:list 24 | endfunction 25 | 26 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 27 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/swap.vim: -------------------------------------------------------------------------------- 1 | " ingo/swap.vim: Functions around the swap file. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/buffer/visible.vim autoload script 5 | " 6 | " Copyright: (C) 2016 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | " 11 | " REVISION DATE REMARKS 12 | " 1.025.001 29-Jan-2016 file creation 13 | 14 | function! ingo#swap#GetNameImpl() 15 | " Use silent! so a failing redir (e.g. recursive redir call) won't hurt. 16 | silent! redir => o | silent swapname | redir END 17 | return (o[1:] ==# 'No swap file' ? '' : o[1:]) 18 | return '' 19 | else 20 | return o[1:] 21 | endif 22 | endfunction 23 | function! ingo#swap#GetName( ... ) 24 | "****************************************************************************** 25 | "* PURPOSE: 26 | " Obtain the filespec of the swap file (like :swapname), for the current 27 | " buffer or the passed buffer number. 28 | "* ASSUMPTIONS / PRECONDITIONS: 29 | " None. 30 | "* EFFECTS / POSTCONDITIONS: 31 | " None. 32 | "* INPUTS: 33 | " a:bufnr Optional buffer number of an existing buffer where the swap file 34 | " should be obtained from. 35 | "* RETURN VALUES: 36 | " filespec of current swapfile, or empty string. 37 | "****************************************************************************** 38 | if a:0 39 | silent! return ingo#buffer#visible#Call(a:1, 'ingo#swap#GetNameImpl', []) 40 | else 41 | return ingo#swap#GetNameImpl() 42 | endif 43 | endfunction 44 | 45 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 46 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/system.vim: -------------------------------------------------------------------------------- 1 | " ingo/system.vim: Functions for invoking shell commands. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2013 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | " 10 | " REVISION DATE REMARKS 11 | " 1.003.001 22-Mar-2013 file creation 12 | 13 | function! ingo#system#Chomped( ... ) 14 | "****************************************************************************** 15 | "* PURPOSE: 16 | " Wrapper around system() that strips off trailing newline(s). 17 | "* ASSUMPTIONS / PRECONDITIONS: 18 | " None. 19 | "* EFFECTS / POSTCONDITIONS: 20 | " None. 21 | "* INPUTS: 22 | " As |system()| 23 | "* RETURN VALUES: 24 | " Output of the shell command, without trailing newline(s). 25 | "****************************************************************************** 26 | return substitute(call('system', a:000), '\n\+$', '', '') 27 | endfunction 28 | 29 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 30 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/tabpage.vim: -------------------------------------------------------------------------------- 1 | " ingo/tabpage.vim: Functions for tab page information. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | let s:save_cpo = &cpo 10 | set cpo&vim 11 | 12 | function! ingo#tabpage#IsBlank( ... ) 13 | if a:0 14 | let l:tabPageNr = a:1 15 | let l:currentBufNr = tabpagebuflist(l:tabPageNr)[0] 16 | else 17 | let l:tabPageNr = tabpagenr() 18 | let l:currentBufNr = bufnr('') 19 | endif 20 | 21 | return ( 22 | \ empty(bufname(l:currentBufNr)) && 23 | \ tabpagewinnr(l:tabPageNr, '$') <= 1 && 24 | \ getbufvar(l:currentBufNr, '&modified') == 0 && 25 | \ empty(getbufvar(l:currentBufNr, '&buftype')) 26 | \) 27 | return l:isEmptyTabPage 28 | endfunction 29 | 30 | let &cpo = s:save_cpo 31 | unlet s:save_cpo 32 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 33 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/window.vim: -------------------------------------------------------------------------------- 1 | " ingo/window.vim: Functions for dealing with windows. 2 | " 3 | " DEPENDENCIES: 4 | " 5 | " Copyright: (C) 2017 Ingo Karkat 6 | " The VIM LICENSE applies to this script; see ':help copyright'. 7 | " 8 | " Maintainer: Ingo Karkat 9 | 10 | function! ingo#window#GotoNext( direction, ... ) 11 | "****************************************************************************** 12 | "* PURPOSE: 13 | " Go to the next window in a:direction. 14 | "* ASSUMPTIONS / PRECONDITIONS: 15 | " None. 16 | "* EFFECTS / POSTCONDITIONS: 17 | " Activates another window. 18 | "* INPUTS: 19 | " a:direction One of 'j', 'k', 'h', 'l'. 20 | " a:count Number of windows to move (default 1). 21 | "* RETURN VALUES: 22 | " 1 if the move was successful, 0 if there's no [a:count] window[s] in that 23 | " direction. 24 | "****************************************************************************** 25 | let l:prevWinNr = winnr() 26 | execute (a:0 > 0 ? a:1 : '') . 'wincmd' a:direction 27 | return winnr() != l:prevWinNr 28 | endfunction 29 | 30 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 31 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/autoload/ingo/workingdir.vim: -------------------------------------------------------------------------------- 1 | " ingo/workingdir.vim: Functions to deal with the current working directory. 2 | " 3 | " DEPENDENCIES: 4 | " - ingo/compat.vim autoload script 5 | " 6 | " Copyright: (C) 2018 Ingo Karkat 7 | " The VIM LICENSE applies to this script; see ':help copyright'. 8 | " 9 | " Maintainer: Ingo Karkat 10 | 11 | let s:compatFor = (exists('g:IngoLibrary_CompatFor') ? ingo#collections#ToDict(split(g:IngoLibrary_CompatFor, ',')) : {}) 12 | 13 | if exists('*haslocaldir') && ! has_key(s:compatFor, 'haslocaldir') 14 | function! ingo#workingdir#ChdirCommand() 15 | return (haslocaldir() ? 'lchdir!' : 'chdir!') 16 | endfunction 17 | else 18 | function! ingo#workingdir#ChdirCommand() 19 | return 'chdir!' 20 | endfunction 21 | endif 22 | 23 | function! ingo#workingdir#Chdir( dirspec ) 24 | execute ingo#workingdir#ChdirCommand() ingo#compat#fnameescape(a:dirspec) 25 | endfunction 26 | function! ingo#workingdir#ChdirToSpecial( cmdlineSpecial ) 27 | execute ingo#workingdir#ChdirCommand() a:cmdlineSpecial 28 | endfunction 29 | 30 | " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : 31 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/all.suite: -------------------------------------------------------------------------------- 1 | cmdargs/file/ 2 | collections/ 3 | collections/recursive/ 4 | compat/ 5 | date/ 6 | digest/ 7 | file/ 8 | function/uniquify/ 9 | fs/paths/split/ 10 | list/ 11 | list/lcs/ 12 | list/pattern/ 13 | list/sequence/ 14 | list/split/ 15 | lists/ 16 | lnum/ 17 | matches/ 18 | regexp/ 19 | regexp/capture/ 20 | regexp/collection/ 21 | regexp/deconstruct/ 22 | regexp/length/ 23 | regexp/split/ 24 | str/ 25 | strdisplaywidth/ 26 | strdisplaywidth/pad/ 27 | subs/BraceCreation/ 28 | subs/BraceExpansion/ 29 | subst/ 30 | subst/expr/ 31 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1010-FilterFileOptionsAndCommands-side-effects.vim: -------------------------------------------------------------------------------- 1 | " Test modification of the passed-in fileglobs List when stripping options and commands. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | let g:fileglobs = ['++ff=unix', '++enc=utf-8', '+setl et', 'foo*', 'bar'] 7 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptionsAndCommands(g:fileglobs), [['foo*', 'bar'], ['++ff=unix', '++enc=utf-8', '+setl et']], 'two options, command, and two files') 8 | call vimtap#Is(g:fileglobs, ['foo*', 'bar'], 'original argument list has been reduced') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1020-FilterFileOptionsAndCommandsToEscaped.vim: -------------------------------------------------------------------------------- 1 | " Test stripping file options and commands with joining and escaping. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(1) 5 | 6 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptionsAndCommandsToEscaped(['++ff=unix', '+setl et| echomsg "foobar"', 'bar']), [['bar'], '++ff=unix +setl\ et|\ \ echomsg\ "foobar"'], 'option, command, and file') 7 | 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1100-FilterFileOptions.vim: -------------------------------------------------------------------------------- 1 | " Test stripping file options. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions([]), [[], []], 'empty fileglobs') 7 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['/tmp/foo']), [['/tmp/foo'], []], 'just a file') 8 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['foo*', 'bar']), [['foo*', 'bar'], []], 'just two files') 9 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['+setl et', 'foo*', 'bar']), [['+setl et', 'foo*', 'bar'], []], 'command is treated as file') 10 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['foo*', '++ff=unix']), [['foo*', '++ff=unix'], []], 'option after fileglob is treated as fileglob') 11 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['++ff=unix', 'foo*', 'bar']), [['foo*', 'bar'], ['++ff=unix']], 'option and two files') 12 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['++ff=unix', '++enc=utf-8', 'foo*', 'bar']), [['foo*', 'bar'], ['++ff=unix', '++enc=utf-8']], 'two options and two files') 13 | 14 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(['++whatis=that', 'foo*', 'bar']), [['++whatis=that', 'foo*', 'bar'], []], 'invalid option is treated as fileglob') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1110-FilterFileOptions-side-effects.vim: -------------------------------------------------------------------------------- 1 | " Test modification of the passed-in fileglobs List when stripping options. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | let g:fileglobs = ['++ff=unix', '++enc=utf-8', 'foo*', 'bar'] 7 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptions(g:fileglobs), [['foo*', 'bar'], ['++ff=unix', '++enc=utf-8']], 'two options and two files') 8 | call vimtap#Is(g:fileglobs, ['foo*', 'bar'], 'original argument list has been reduced') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1120-FilterFileOptionsToEscaped.vim: -------------------------------------------------------------------------------- 1 | " Test stripping file options and commands with joining and escaping. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(1) 5 | 6 | call vimtap#Is(ingo#cmdargs#file#FilterFileOptionsToEscaped(['++enc=utf-8', '++ff=unix', 'bar']), [['bar'], '++enc=utf-8 ++ff=unix'], 'two options, and file') 7 | 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1200-FileOptionsAndCommandsToEscapedExCommandLine.vim: -------------------------------------------------------------------------------- 1 | " Test joining and escaping of file options and commands. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#cmdargs#file#FileOptionsAndCommandsToEscapedExCommandLine(['++nobin', '++ff=dos']), '++nobin ++ff=dos', 'two options') 7 | call vimtap#Is(ingo#cmdargs#file#FileOptionsAndCommandsToEscapedExCommandLine(['setl et | echomsg "foobar"|set wrap']), 'setl\ et\ |\ echomsg\ "foobar"|set\ wrap', 'one command') 8 | call vimtap#Is(ingo#cmdargs#file#FileOptionsAndCommandsToEscapedExCommandLine(['++ff=unix', '++enc=utf-8', 'setl et | echomsg "foobar"|set wrap']), '++ff=unix ++enc=utf-8 setl\ et\ |\ echomsg\ "foobar"|set\ wrap', 'two options and one command') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/cmdargs/file/t1210-FileOptionsAndCommandsToEscapedExCommandLine-no-side-effect.vim: -------------------------------------------------------------------------------- 1 | " Test joining and escaping of file options and commands has no side effect. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | let s:fileglobs = ['++nobin', 'setl et | echomsg "foobar"|set wrap'] 7 | let s:originalFileGlobs = copy(s:fileglobs) 8 | call vimtap#Is(ingo#cmdargs#file#FileOptionsAndCommandsToEscapedExCommandLine(s:fileglobs), '++nobin setl\ et\ |\ echomsg\ "foobar"|set\ wrap', 'one option one command') 9 | call vimtap#Is(s:fileglobs, s:originalFileGlobs, 'original fileglobs are not modified') 10 | 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/recursive/t1000-map.vim: -------------------------------------------------------------------------------- 1 | " Test recursive mapping. 2 | 3 | let s:expr = 'toupper(v:val)' 4 | function! s:CreateData() 5 | return ['a', 'b', [{'foo': 'bar', 'rec': ['e', 'ff']}, 'd']] 6 | endfunction 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(4) 10 | 11 | let s:data = s:CreateData() 12 | call vimtap#Is(ingo#collections#recursive#map(s:data, s:expr), ['A', 'B', [{'foo': 'BAR', 'rec': ['E', 'FF']}, 'D']], 'in-place toupper') 13 | call vimtap#Is(s:data, ['A', 'B', [{'foo': 'BAR', 'rec': ['E', 'FF']}, 'D']], 'in-place toupper modifies original') 14 | 15 | let s:data = s:CreateData() 16 | call vimtap#Is(ingo#collections#recursive#MapWithCopy(s:data, s:expr), ['A', 'B', [{'foo': 'BAR', 'rec': ['E', 'FF']}, 'D']], 'copied toupper') 17 | call vimtap#Is(s:data, ['a', 'b', [{'foo': 'bar', 'rec': ['e', 'ff']}, 'd']], 'copied toupper keeps original') 18 | 19 | call vimtest#Quit() 20 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/recursive/t1010-map-simple.vim: -------------------------------------------------------------------------------- 1 | " Test recursive mapping of simple collections. 2 | 3 | let s:expr = 'toupper(v:val)' 4 | 5 | call vimtest#StartTap() 6 | call vimtap#Plan(8) 7 | 8 | let s:data = ['a', 'b', 'c'] 9 | call vimtap#Is(ingo#collections#recursive#map(s:data, s:expr), ['A', 'B', 'C'], 'in-place toupper of simple List') 10 | call vimtap#Is(s:data, ['A', 'B', 'C'], 'in-place toupper modifies original') 11 | 12 | let s:data = ['a', 'b', 'c'] 13 | call vimtap#Is(ingo#collections#recursive#MapWithCopy(s:data, s:expr), ['A', 'B', 'C'], 'copied toupper of simple List') 14 | call vimtap#Is(s:data, ['a', 'b', 'c'], 'copied toupper keeps original') 15 | 16 | let s:data = {'a': 'x', 'b': 'y'} 17 | call vimtap#Is(ingo#collections#recursive#map(s:data, s:expr), {'a': 'X', 'b': 'Y'}, 'in-place toupper of simple Dict') 18 | call vimtap#Is(s:data, {'a': 'X', 'b': 'Y'}, 'in-place toupper modifies original') 19 | 20 | let s:data = {'a': 'x', 'b': 'y'} 21 | call vimtap#Is(ingo#collections#recursive#MapWithCopy(s:data, s:expr), {'a': 'X', 'b': 'Y'}, 'copied toupper of simple Dict') 22 | call vimtap#Is(s:data, {'a': 'x', 'b': 'y'}, 'copied toupper keeps original') 23 | 24 | call vimtest#Quit() 25 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t1000-SplitKeepSeparators.vim: -------------------------------------------------------------------------------- 1 | " Test splitting including separators. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#collections#SplitKeepSeparators('foo-bar.baz.,.a;b;c.', '\A'), ['foo', '-', 'bar', '.', 'baz', '.', '', ',', '', '.', 'a', ';', 'b', ';', 'c', '.'], 'splitting on single non-alpha') 7 | call vimtap#Is(ingo#collections#SplitKeepSeparators('foo-bar.baz.,.a;b;c.', '\A\+'), ['foo', '-', 'bar', '.', 'baz', '.,.', 'a', ';', 'b', ';', 'c', '.'], 'splitting on non-alphas') 8 | call vimtap#Is(ingo#collections#SplitKeepSeparators('-foo-', '\A', 0), ['-', 'foo', '-'], 'omit first and last empty') 9 | call vimtap#Is(ingo#collections#SplitKeepSeparators('-foo-', '\A', 1), ['', '-', 'foo', '-', ''], 'keep first and last empty') 10 | 11 | call vimtap#Is(ingo#collections#SplitKeepSeparators('', '\A'), [], 'empty text') 12 | call vimtap#Is(ingo#collections#SplitKeepSeparators('x', '\A'), ['x'], 'no separator') 13 | call vimtap#Is(ingo#collections#SplitKeepSeparators('-', '\A', 0), ['-'], 'nokeep on separator only text') 14 | call vimtap#Is(ingo#collections#SplitKeepSeparators('-', '\A', 1), ['', '-', ''], 'keep on separator only text') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t1100-SeparateItemsAndSeparators.vim: -------------------------------------------------------------------------------- 1 | " Test splitting into two Lists. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('foo-bar.baz.,.a;b;c.', '\A'), [['foo', 'bar', 'baz', '', '', 'a', 'b', 'c'], ['-', '.', '.', ',', '.', ';', ';', '.']], 'splitting on single non-alpha') 7 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('foo-bar.baz.,.a;b;c.', '\A\+'), [['foo', 'bar', 'baz', 'a', 'b', 'c'], ['-', '.', '.,.', ';', ';', '.']], 'splitting on non-alphas') 8 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('-foo-', '\A', 0), [['foo'], ['-', '-']], 'omit first and last empty') 9 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('-foo-', '\A', 1), [['', 'foo', ''], ['-', '-']], 'keep first and last empty') 10 | 11 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('', '\A'), [[], []], 'empty text') 12 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('x', '\A'), [['x',], []], 'no separator') 13 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('-', '\A', 0), [[], ['-']], 'nokeep on separator only text') 14 | call vimtap#Is(ingo#collections#SeparateItemsAndSeparators('-', '\A', 1), [['', ''], ['-']], 'keep on separator only text') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t1200-SplitIntoMatches.vim: -------------------------------------------------------------------------------- 1 | " Test splitting into matches. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(9) 5 | 6 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\A'), ['-', '.', '.', ',', '.', ';', ';', '.'], 'splitting for single non-alpha') 7 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\A\+'), ['-', '.', '.,.', ';', ';', '.'], 'splitting for non-alphas') 8 | call vimtap#Is(ingo#collections#SplitIntoMatches('-foo-', '\A'), ['-', '-'], 'start and end with match') 9 | 10 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\a'), ['f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z', 'a', 'b', 'c'], 'splitting for single alpha') 11 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\a\+'), ['foo', 'bar', 'baz', 'a', 'b', 'c'], 'splitting for alphas') 12 | 13 | call vimtap#Is(ingo#collections#SplitIntoMatches('', '\A'), [], 'empty text') 14 | call vimtap#Is(ingo#collections#SplitIntoMatches('x', '\A'), [], 'no separator') 15 | call vimtap#Is(ingo#collections#SplitIntoMatches('-', '\A', 0), ['-'], 'nokeep on separator only text') 16 | call vimtap#Is(ingo#collections#SplitIntoMatches('-', '\A', 1), ['-'], 'keep on separator only text') 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t1210-SplitIntoMatches-allowedDiscardPattern.vim: -------------------------------------------------------------------------------- 1 | " Test completely splitting into matches. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(10) 5 | 6 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\a\+\A\+', ''), ['foo-', 'bar.', 'baz.,.', 'a;', 'b;', 'c.'], 'splitting for alphas-non-alphas') 7 | call vimtap#err#Throws("SplitIntoMatches: Cannot discard 'c'", "call ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c', '\\a\\+\\A\\+', '')", 'exception thrown') 8 | 9 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar!baz', '\a\+', '[^.;?]'), ['foo', 'bar', 'baz'], 'splitting for alphas-non-alpha') 10 | call vimtap#err#Throws("SplitIntoMatches: Cannot discard '.'", "call ingo#collections#SplitIntoMatches('foo-bar.baz', '\\a\\+', '[^.;?]')", 'exception thrown') 11 | call vimtap#err#Throws("SplitIntoMatches: Cannot discard '.'", "call ingo#collections#SplitIntoMatches('foo-bar.baz', '\\a\\+', '-')", 'exception thrown') 12 | 13 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\a\+\A\+', '^$'), ['foo-', 'bar.', 'baz.,.', 'a;', 'b;', 'c.'], 'splitting for alphas-non-alphas with ^$') 14 | call vimtap#Is(ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\a\+\A', '\A\{0,2\}'), ['foo-', 'bar.', 'baz.', 'a;', 'b;', 'c.'], 'splitting for alphas-non-alphas with ^$') 15 | 16 | call vimtap#err#Throws("SplitIntoMatches: Cannot discard '.,.'", "call ingo#collections#SplitIntoMatches('foo-bar.baz.,.a;b;c.', '\\a\\+', '\\A\\?')", 'exception thrown') 17 | 18 | call vimtap#Is(ingo#collections#SplitIntoMatches('foobarbaz', '...', ''), ['foo', 'bar', 'baz'], 'splitting into three-char groups') 19 | call vimtap#err#Throws("SplitIntoMatches: Cannot discard 'xy'", "call ingo#collections#SplitIntoMatches('foobarquuxy', '...', '')", 'exception thrown') 20 | 21 | call vimtest#Quit() 22 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t2000-SortOnOneAttribute.vim: -------------------------------------------------------------------------------- 1 | " Test sorting dicts based on one attribute. 2 | 3 | function! s:SortOnFoo( o1, o2 ) 4 | return ingo#collections#SortOnOneAttribute('foo', a:o1, a:o2) 5 | endfunction 6 | function! s:SortOnBar( o1, o2 ) 7 | return ingo#collections#SortOnOneAttribute('bar', a:o1, a:o2) 8 | endfunction 9 | function! s:SortOnBarWithDefault( o1, o2 ) 10 | return ingo#collections#SortOnOneAttribute('bar', a:o1, a:o2, 'z') 11 | endfunction 12 | 13 | let s:one = {'foo': 1, 'bar': 'first'} 14 | let s:two = {'foo': 2} 15 | let s:three = {'foo': 3, 'bar': 'third'} 16 | let s:objects = [s:two, s:three, s:one] 17 | 18 | call vimtest#StartTap() 19 | call vimtap#Plan(3) 20 | 21 | call vimtap#Is(sort(copy(s:objects), 's:SortOnFoo'), [s:one, s:two, s:three], 'sorted based on foo attribute') 22 | call vimtap#Is(sort(copy(s:objects), 's:SortOnBar'), [s:two, s:one, s:three], 'sorted based on (partially missing) bar attribute') 23 | call vimtap#Is(sort(copy(s:objects), 's:SortOnBarWithDefault'), [s:one, s:three, s:two], 'sorted based on (partially missing) bar attribute with default z') 24 | 25 | call vimtest#Quit() 26 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t2010-PrioritySort.vim: -------------------------------------------------------------------------------- 1 | " Test sorting dicts based on a priority attribute. 2 | 3 | let s:one = {'priority': 1, 'bar': 'first'} 4 | let s:two = {'priority': 2} 5 | let s:three = {'priority': 3, 'bar': 'third'} 6 | let s:objects = [s:two, s:three, s:one] 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(1) 10 | 11 | call vimtap#Is(sort(copy(s:objects), 'ingo#collections#PrioritySort'), [s:one, s:two, s:three], 'sorted based on priority') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/collections/t2020-SortOnTwoAttributes.vim: -------------------------------------------------------------------------------- 1 | " Test sorting dicts based on two attributes. 2 | 3 | function! s:SortOnFooThenBar( o1, o2 ) 4 | return ingo#collections#SortOnTwoAttributes('foo', 'bar', a:o1, a:o2) 5 | endfunction 6 | function! s:SortWithDefault( o1, o2 ) 7 | return ingo#collections#SortOnTwoAttributes('foo', 'bar', a:o1, a:o2, 99) 8 | endfunction 9 | function! s:SortWithDefaults( o1, o2 ) 10 | return ingo#collections#SortOnTwoAttributes('foo', 'bar', a:o1, a:o2, 99, 'zzz') 11 | endfunction 12 | 13 | let s:one = { 'bar': 'first'} 14 | let s:two = {'foo': 2 } 15 | let s:three = { 'bar': 'third'} 16 | let s:four = {'foo': 4, 'bar': 'fourth'} 17 | let s:five = {'foo': 4, 'bar': 'fifth'} 18 | let s:objects = [s:four, s:two, s:five, s:three, s:five, s:one] 19 | 20 | call vimtest#StartTap() 21 | call vimtap#Plan(3) 22 | 23 | call vimtap#Is(sort(copy(s:objects), 's:SortOnFooThenBar'), [s:one, s:three, s:two, s:five, s:five, s:four], 'sorted based on foo then bar attributes') 24 | call vimtap#Is(sort(copy(s:objects), 's:SortWithDefault'), [s:two, s:five, s:five, s:four, s:one, s:three], 'sorted based on foo (default 99) then bar (same default) attributes') 25 | let s:twoBe = {'foo': 2, 'bar': 'exists'} 26 | call vimtap#Is(sort([s:four, s:two, s:three, s:twoBe, s:one], 's:SortWithDefaults'), [s:twoBe, s:two, s:four, s:one, s:three], 'sorted based on foo (default 99) then bar (default zzz) attributes') 27 | 28 | call vimtest#Quit() 29 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/compat/helpers/CompatChecker.vim: -------------------------------------------------------------------------------- 1 | function! IsCompatible( originalFunctionName, description, ... ) 2 | let l:compatFunctionName = 'ingo#compat#' . a:originalFunctionName 3 | 4 | let l:expected = call(a:originalFunctionName, a:000) 5 | let l:got = call(l:compatFunctionName, a:000) 6 | call vimtap#Is(l:got, l:expected, a:description) 7 | endfunction 8 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/compat/t1000-matchstrpos.vim: -------------------------------------------------------------------------------- 1 | " Test matchstrpos() compatibility. 2 | 3 | call vimtest#SkipAndQuitIf(! exists('*matchstrpos'), 'Need support for matchstrpos') 4 | 5 | source helpers/CompatChecker.vim 6 | let g:IngoLibrary_CompatFor = 'matchstrpos' 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(12) 10 | 11 | call IsCompatible('matchstrpos', 'string match', 'testing', 'ing') 12 | call IsCompatible('matchstrpos', 'string not matching', 'testing', 'xxx') 13 | call IsCompatible('matchstrpos', 'first match', 'testing', 't') 14 | 15 | call IsCompatible('matchstrpos', 'start to second match', 'testing', 't', 3) 16 | call IsCompatible('matchstrpos', 'start beyond matches', 'testing', 't', 7) 17 | 18 | call IsCompatible('matchstrpos', 'string count 2', "testing", "..", 0, 2) 19 | 20 | 21 | call IsCompatible('matchstrpos', 'List match', [1, '__x'], '\a') 22 | call IsCompatible('matchstrpos', 'List not matching', [1, '__x'], 'xxx') 23 | 24 | call IsCompatible('matchstrpos', 'List start to second match', ['foxy', 'foobar', 'foony', 'bar'], 'o', 1) 25 | call IsCompatible('matchstrpos', 'List start beyond matches', ['foxy', 'foobar', 'foony', 'bar'], 'o', 3) 26 | 27 | call IsCompatible('matchstrpos', 'List count 2', ['foxy', 'foobar', 'foony', 'bar'], 'o', 0, 2) 28 | call IsCompatible('matchstrpos', 'List start to second, count 2', ['foony', 'faabar', 'fiiny', 'bar'], '\(.\)\1', 1, 2) 29 | 30 | call vimtest#Quit() 31 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/compat/t1100-trim.vim: -------------------------------------------------------------------------------- 1 | " Test trim() compatibility. 2 | 3 | call vimtest#SkipAndQuitIf(! exists('*trim'), 'Need support for trim') 4 | 5 | source helpers/CompatChecker.vim 6 | let g:IngoLibrary_CompatFor = 'trim' 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(6) 10 | 11 | call IsCompatible('trim', 'trim on empty string', "") 12 | call IsCompatible('trim', 'trim nothing', "some text") 13 | call IsCompatible('trim', 'trim spaces', " some text ") 14 | call IsCompatible('trim', 'trim defaults', " \r\t\t\r RESERVE \t\n\x0B\xA0") 15 | call IsCompatible('trim', 'trim custom mask', "rmX>rrm", "rm<>") 16 | call IsCompatible('trim', 'trim spaces around non-ASCII text', " \u222A\uFF4E\u30A7\u00E7\u00F8\u03B4\u0639\u3128\uC6C3\u8A9E ") 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/compat/t1200-strcharpart.vim: -------------------------------------------------------------------------------- 1 | " Test strcharpart() compatibility. 2 | 3 | call vimtest#SkipAndQuitIf(! exists('*strcharpart'), 'Need support for strcharpart') 4 | 5 | source helpers/CompatChecker.vim 6 | let g:IngoLibrary_CompatFor = 'strcharpart' 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(5) 10 | 11 | call IsCompatible('strcharpart', 'middle ASCII part with length', 'anASCIItext', 2, 5) 12 | call IsCompatible('strcharpart', 'middle ASCII part without length', 'anASCIItext', 2) 13 | call IsCompatible('strcharpart', 'middle Unicode part with length', 'an\u222A\uFF4E\u30A7\u00E7\u00F8\u03B4\u0639\u3128\uC6C3\u8A9Etext', 5, 4) 14 | call IsCompatible('strcharpart', 'middle Unicode part without length', 'an\u222A\uFF4E\u30A7\u00E7\u00F8\u03B4\u0639\u3128\uC6C3\u8A9Etext', 5) 15 | 16 | call IsCompatible('strcharpart', 'negative start', 'anASCIItext', -2, 5) 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/date/t1000-strftime.vim: -------------------------------------------------------------------------------- 1 | " Test strftime() emulation. 2 | 3 | function! MyTime( format, ... ) 4 | return (a:0 ? a:1[0] . a:1[0] . ':' . a:1[1] . a:1[1] : '23:59') 5 | endfunction 6 | let g:IngoLibrary_StrftimeEmulation = {'%Y': '1999', '%H:%M': function('MyTime'), '*': 'Joker'} 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(7) 10 | 11 | call vimtap#Is(ingo#date#strftime('%Y'), '1999', 'Emulated %Y') 12 | call vimtap#Is(ingo#date#strftime('%Y', 1540148357), '1999', 'Emulated %Y with time') 13 | 14 | call vimtap#Is(ingo#date#strftime('%H:%M'), '23:59', 'Emulated %H:M') 15 | call vimtap#Is(ingo#date#strftime('%H:%M', 1540148357), '11:55', 'Emulated %H:M with time') 16 | 17 | call vimtap#Is(ingo#date#strftime('%c'), 'Joker', 'Emulated fallback') 18 | call vimtap#Is(ingo#date#strftime('%c', 1540148357), 'Joker', 'Emulated fallback with time') 19 | 20 | unlet g:IngoLibrary_StrftimeEmulation['*'] 21 | call vimtap#err#Throws('strftime: Unhandled format %c and no fallback * key in g:IngoLibrary_StrftimeEmulation', "call ingo#date#strftime('%c')", 'Exception without fallback') 22 | 23 | call vimtest#Quit() 24 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/digest/t1010-get-long.vim: -------------------------------------------------------------------------------- 1 | " Test digesting long lists of strings. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#digest#Get( 7 | \ [ 8 | \ 'a-long-list-of-various-stuff-and-so-see-here', 9 | \ 'the-long-list-has-various-things-in-here-and-nowhere', 10 | \ 'my-long-list-can-do-various-things-for-here-and-there', 11 | \ ], '\A'), 12 | \ ['-long-list-', '-various-', '-and-', 'here'], 'long list') " Note: 'here' loses its preceding separator because in other items is is grouped together with '-here-and-', so it's missing at that position. 13 | 14 | call vimtap#Is(ingo#digest#Get( 15 | \ [ 16 | \ 'the-long-list-has-various-things-in-here-and-nowhere', 17 | \ 'a-long-list-of-various-stuff-and-so-see-here', 18 | \ 'my-long-list-can-do-various-things-for-here-and-there', 19 | \ ], '\A'), 20 | \ ['-long-list-', '-various-', '-here-and'], 'long list, different ordering') 21 | 22 | call vimtap#Is(ingo#digest#Get( 23 | \ [ 24 | \ 'a-long-list-of-various-stuff-and-so-see-here', 25 | \ 'the-long-list-has-various-things-in-here-and-nowhere', 26 | \ 'my-long-list-can-do-various-things-for-here-and-there', 27 | \ ], '\A', 60), 28 | \ ['-long-list-', '-various-things-', '-here-and-'], 'long list with percentage') 29 | 30 | call vimtest#Quit() 31 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/ipsum.txt: -------------------------------------------------------------------------------- 1 | Suspendisse potenti. Aenean sed velit. Nunc a urna quis turpis imperdiet 2 | sollicitudin. Mauris aliquam mauris ut tortor. Pellentesque tincidunt mattis 3 | nibh. In id lectus eu magna vulputate ultrices. Aliquam interdum varius enim. 4 | Maecenas at mauris. Sed sed nibh. Nam non turpis. Maecenas fermentum ni 5 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/lorem.txt: -------------------------------------------------------------------------------- 1 | Dapibus pellentesque. In non lacus. Nullam tristique nunc ut arcu scelerisque 2 | aliquam. Nullam viverra magna vitae leo. Vestibulum in lacus sit amet lectus 3 | tempus aliquet. Duis cursus nisl ac orci. Do 4 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/nulla.txt: -------------------------------------------------------------------------------- 1 | Phasellus ipsum odio, suscipit nec, fringilla at, vehicula quis, tellus. 2 | Phasellus gravida condimentum dui. Aenean imperdiet arcu vitae ipsum. Duis 3 | dapibus, nisi non porttitor iaculis, ligula odio sollicitudin mauris, non 4 | luctus nunc massa a velit. Fusce ac nisi. Integer volutpat elementum metus. 5 | Vivamus luctus ultricies diam. Curabitur euismod. Vivamus quam. Nunc ante. 6 | Nulla mi nulla, vehicula!! 7 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1000-GetLines-uncached.vim: -------------------------------------------------------------------------------- 1 | " Test gettings lines from a file without the cache. 2 | 3 | let g:IngoLibrary_FileCacheMaxSize = 0 4 | 5 | call vimtest#StartTap() 6 | call vimtap#Plan(6) 7 | 8 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem') 9 | call vimtap#Is(ingo#file#GetCachedFilesByAge(), [], 'Nothing cached') 10 | call vimtap#Is(len(ingo#file#GetLines('ipsum.txt')), 4, 'Get ipsum') 11 | call vimtap#Is(len(ingo#file#GetLines('nulla.txt')), 6, 'Get nulla') 12 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem again') 13 | call vimtap#Is(ingo#file#GetCachedFilesByAge(), [], 'Nothing cached') 14 | 15 | call vimtest#Quit() 16 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1010-GetLines-cached.vim: -------------------------------------------------------------------------------- 1 | " Test gettings lines from a file with a small cache. 2 | 3 | let g:IngoLibrary_FileCacheMaxSize = 600 4 | 5 | function! s:GetCachedFilenamesByAge() 6 | return map(ingo#file#GetCachedFilesByAge(), 'fnamemodify(v:val, ":t:r")') 7 | endfunction 8 | call vimtest#StartTap() 9 | call vimtap#Plan(15) 10 | 11 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem') 12 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['lorem'], 'lorem cached') 13 | 14 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem again') 15 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['lorem'], 'lorem cached') 16 | 17 | sleep 1 18 | call vimtap#Is(len(ingo#file#GetLines('ipsum.txt')), 4, 'Get ipsum') 19 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['lorem', 'ipsum'], 'lorem > ipsum cached') 20 | 21 | sleep 1 22 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem again') 23 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['ipsum', 'lorem'], 'ipsum > lorem cached') 24 | 25 | sleep 1 26 | call vimtap#Is(len(ingo#file#GetLines('nulla.txt')), 6, 'Get nulla') 27 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['lorem', 'nulla'], 'lorem > nulla cached; ipsum got evicted') 28 | 29 | sleep 1 30 | call vimtap#Is(len(ingo#file#GetLines('ipsum.txt')), 4, 'Get ipsum again') 31 | sleep 1 32 | call vimtap#Is(len(ingo#file#GetLines('nulla.txt')), 6, 'Get nulla again') 33 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['nulla'], 'only nulla cached; ipsum got evicted') 34 | 35 | sleep 1 36 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem again') 37 | call vimtap#Is(s:GetCachedFilenamesByAge(), ['nulla', 'lorem'], 'nulla > lorem cached') 38 | 39 | call vimtest#Quit() 40 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1020-GetLines-cache-too-small.vim: -------------------------------------------------------------------------------- 1 | " Test gettings lines from a file with a too small small cache. 2 | 3 | let g:IngoLibrary_FileCacheMaxSize = 200 4 | 5 | call vimtest#StartTap() 6 | call vimtap#Plan(4) 7 | 8 | call vimtap#Is(len(ingo#file#GetLines('ipsum.txt')), 4, 'Get ipsum') 9 | call vimtap#Is(ingo#file#GetCachedFilesByAge(), [], 'ipsum too large; nothing cached') 10 | 11 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem') 12 | call vimtap#Is(len(ingo#file#GetCachedFilesByAge()), 1, 'lorem cached, it fits the cache') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1030-GetLines-immutable-cache.vim: -------------------------------------------------------------------------------- 1 | " Test that lines from a file do no modify the cache itself. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | let s:lines = ingo#file#GetLines('lorem.txt') 7 | let s:firstLine = s:lines[0] 8 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem') 9 | 10 | call remove(s:lines, -1) 11 | let s:lines[0] = 'Changed!' 12 | call vimtap#Is(len(s:lines), 2, 'Removed last line') 13 | 14 | call vimtap#Is(len(ingo#file#GetLines('lorem.txt')), 3, 'Get lorem again still returns three lines') 15 | call vimtap#Is(ingo#file#GetLines('lorem.txt')[0], s:firstLine, 'Get lorem again still returns the original first line') 16 | 17 | call vimtest#Quit() 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1040-GetLines-nonexisting-file.vim: -------------------------------------------------------------------------------- 1 | " Test reading a non-existing file. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(1) 5 | 6 | call vimtap#Is(ingo#file#GetLines('doesnotexist.txt'), [], 'Get non-existing file returns empty List') 7 | 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/file/t1050-GetLines-cache-update.vim: -------------------------------------------------------------------------------- 1 | " Test getting lines from a file that is updated and then deleted. 2 | 3 | let s:tempfile = tempname() 4 | call writefile(['foo', 'bar'], s:tempfile, 's') 5 | 6 | call vimtest#StartTap() 7 | call vimtap#Plan(4) 8 | 9 | call vimtap#Is(ingo#file#GetLines(s:tempfile), ['foo', 'bar'], 'Get tempfile') 10 | 11 | sleep 1 12 | call writefile(['fox', 'booze', 'more'], s:tempfile, 's') 13 | call vimtap#Is(ingo#file#GetLines(s:tempfile), ['fox', 'booze', 'more'], 'Get updated tempfile') 14 | 15 | sleep 1 16 | if delete(s:tempfile) != 0 17 | call vimtap#BailOut('Failed to delete temp file: ' . s:tempfile) 18 | endif 19 | call vimtap#Is(ingo#file#GetLines(s:tempfile), [], 'Get deleted tempfile returns empty List') 20 | call vimtap#Is(ingo#file#GetCachedFilesByAge(), [], 'Nothing is cached any longer') 21 | 22 | call vimtest#Quit() 23 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/fs/paths/split/t1010-TruncateTo-backslash.vim: -------------------------------------------------------------------------------- 1 | " Test truncation of backslash-separated filespec. 2 | 3 | scriptencoding utf-8 4 | 5 | call vimtest#StartTap() 6 | call vimtap#Plan(2) 7 | let s:longFile = 'C:\tmp\with one of\these\very\loooooong\path\in\there\before\filename.txt' 8 | 9 | call vimtap#Is(ingo#fs#path#split#TruncateTo(s:longFile, 50, '\'), 'C:\tmp\with one of\…\in\there\before\filename.txt', 'drop four directories') 10 | call vimtap#Is(ingo#fs#path#split#TruncateTo(s:longFile, 50, '/'), 'C:\tmp\with one of\these\…here\before\filename.txt', 'truncation as one string with wrong path separator') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/fs/paths/split/t1020-TruncateTo-truncation-indicator.vim: -------------------------------------------------------------------------------- 1 | " Test truncation with custom truncation indicator. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | let s:longFile = '/tmp/with/this/very/loooooong/path/in/there/before/filename.txt' 7 | call vimtap#Is(ingo#fs#path#split#TruncateTo(s:longFile, 52, '/', ' - '), '/tmp/with/this/ - /path/in/there/before/filename.txt', 'drop three directories') 8 | call vimtap#Is(ingo#fs#path#split#TruncateTo(s:longFile, 52, '/', '........'), '/tmp/with/this/......../in/there/before/filename.txt', 'drop four directories with long truncation indicator') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/function/uniquify/t1000-ReturnValue.vim: -------------------------------------------------------------------------------- 1 | " Test unique return values. 2 | 3 | function! TestFunction() 4 | return remove(s:values, 0) 5 | endfunction 6 | 7 | call vimtest#StartTap() 8 | call vimtap#Plan(9) 9 | 10 | let s:values = [1, 2, 3] 11 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 1, 't1 1.') 12 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 2, 't1 2.') 13 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 3, 't1 3.') 14 | 15 | let s:values = [1, 1, 3, 4] 16 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t2', 'TestFunction'), 1, 't2 1.') 17 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t2', 'TestFunction'), 3, 't2 2.') 18 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t2', 'TestFunction'), 4, 't2 3.') 19 | 20 | let s:values = [1, 1, 1, 4, 4, 4, 4, 5] 21 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t3', 'TestFunction'), 1, 't3 1.') 22 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t3', 'TestFunction'), 4, 't3 2.') 23 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t3', 'TestFunction'), 5, 't3 3.') 24 | 25 | call vimtest#Quit() 26 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/function/uniquify/t1010-ReturnValue-scopes.vim: -------------------------------------------------------------------------------- 1 | " Test unique return values with different scopes. 2 | 3 | function! TestFunctionA() 4 | return remove(s:valuesA, 0) 5 | endfunction 6 | function! TestFunctionB() 7 | return remove(s:valuesB, 0) 8 | endfunction 9 | 10 | call vimtest#StartTap() 11 | call vimtap#Plan(6) 12 | 13 | let s:valuesA = [1, 1, 3, 4] 14 | let s:valuesB = [1, 1, 9, 3] 15 | call vimtap#Is(ingo#function#uniquify#ReturnValue('A', 'TestFunctionA'), 1, 'A 1.') 16 | call vimtap#Is(ingo#function#uniquify#ReturnValue('B', 'TestFunctionB'), 1, 'B 1.') 17 | call vimtap#Is(ingo#function#uniquify#ReturnValue('A', 'TestFunctionA'), 3, 'A 2.') 18 | call vimtap#Is(ingo#function#uniquify#ReturnValue('B', 'TestFunctionB'), 9, 'B 2.') 19 | call vimtap#Is(ingo#function#uniquify#ReturnValue('A', 'TestFunctionA'), 4, 'A 3.') 20 | call vimtap#Is(ingo#function#uniquify#ReturnValue('B', 'TestFunctionB'), 3, 'B 3.') 21 | 22 | call vimtest#Quit() 23 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/function/uniquify/t1050-Clear.vim: -------------------------------------------------------------------------------- 1 | " Test clearing records for unique return values. 2 | 3 | function! TestFunction() 4 | return remove(s:values, 0) 5 | endfunction 6 | 7 | call vimtest#StartTap() 8 | call vimtap#Plan(3) 9 | 10 | let s:values = [1, 1, 3, 4] 11 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 1, 't1 1.') 12 | call ingo#function#uniquify#Clear('t1') 13 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 1, 't1 after clear') 14 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 3, 't1 3.') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/function/uniquify/t1060-SetMaxAttempts.vim: -------------------------------------------------------------------------------- 1 | " Test maximum attempts for unique return values. 2 | 3 | function! TestFunction() 4 | return remove(s:values, 0) 5 | endfunction 6 | 7 | call vimtest#StartTap() 8 | call vimtap#Plan(2) 9 | 10 | let s:values = [1, 1, 1, 1, 5] 11 | call ingo#function#uniquify#SetMaxAttempts('t1', 3) 12 | call vimtap#Is(ingo#function#uniquify#ReturnValue('t1', 'TestFunction'), 1, 't1 1.') 13 | call vimtap#err#Throws('ReturnValue: Too many invocations with same return value: 3', 'call ingo#function#uniquify#ReturnValue("t1", "TestFunction")', 'Unique value only after fourth attempt') 14 | 15 | call vimtest#Quit() 16 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/lcs/t1000-FindLongestCommon.vim: -------------------------------------------------------------------------------- 1 | " Test find longest common substrings. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 7 | \ ['foobar', 'fooxy', 'foobitch']), 8 | \ 'foo', 9 | \ 'one common at front' 10 | \) 11 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 12 | \ ['myfoo', 'thefoo', 'theyfoo']), 13 | \ 'foo', 14 | \ 'one common at end' 15 | \) 16 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 17 | \ ['myfoobar', 'thefooxy', 'theyfoobitch']), 18 | \ 'foo', 19 | \ 'one common in middle' 20 | \) 21 | 22 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 23 | \ ['metfooforbarbi', 'havefootobasil', 'gotfooinbasin']), 24 | \ 'foo', 25 | \ 'longer common before shorter' 26 | \) 27 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 28 | \ ['barbigetfoofor', 'basilgivefooto', 'basingotfooin']), 29 | \ 'foo', 30 | \ 'longer common after shorter' 31 | \) 32 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 33 | \ ['basbigetfoofor', 'basilgivefooto', 'basingotfooin']), 34 | \ 'bas', 35 | \ 'same length common prefers first' 36 | \) 37 | 38 | call vimtest#Quit() 39 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/lcs/t1010-FindLongestCommon-minimumLength.vim: -------------------------------------------------------------------------------- 1 | " Test find longest common substrings with a mimimum length. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 7 | \ ['myfoobar', 'thefooxy', 'theyfoobitch'], 3), 8 | \ 'foo', 9 | \ 'minimumLength reached' 10 | \) 11 | call vimtap#Is(ingo#list#lcs#FindLongestCommon( 12 | \ ['myfoobar', 'thefooxy', 'theyfoobitch'], 4), 13 | \ '', 14 | \ 'minimumLength missed' 15 | \) 16 | 17 | call vimtest#Quit() 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/lcs/t2000-FindAllCommon.vim: -------------------------------------------------------------------------------- 1 | " Test find all common substrings. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 7 | \ ['foobar', 'fooxy', 'foobitch']), 8 | \ [[[], ['bar', 'xy', 'bitch']], ['foo']], 9 | \ 'one common at front' 10 | \) 11 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 12 | \ ['myfoo', 'thefoo', 'theyfoo']), 13 | \ [[['my', 'the', 'they'], []], ['foo']], 14 | \ 'one common at end' 15 | \) 16 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 17 | \ ['myfoobar', 'thefooxy', 'theyfoobitch']), 18 | \ [[['my', 'the', 'they'], ['bar', 'xy', 'bitch']], ['foo']], 19 | \ 'one common in middle' 20 | \) 21 | 22 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 23 | \ ['metfooforbarby', 'havefootobasil', 'gotfooinbasin']), 24 | \ [[['met', 'have', 'got'], ['for', 'to', 'in'], ['rby', 'sil', 'sin']], ['foo', 'ba']], 25 | \ 'longer common before shorter' 26 | \) 27 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 28 | \ ['barbygetfoofor', 'basilgivefooto', 'basingotfooin']), 29 | \ [[[], ['rby', 'sil', 'sin'], ['et', 'ive', 'ot'], ['for', 'to', 'in']], ['ba', 'g', 'foo']], 30 | \ 'longer common after shorter' 31 | \) 32 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 33 | \ ['basbygetfoofor', 'basilgivefooto', 'basingotfooin']), 34 | \ [[[], ['by', 'il', 'in'], ['et', 'ive', 'ot'], ['for', 'to', 'in']], ['bas', 'g', 'foo']], 35 | \ 'same length common prefers first' 36 | \) 37 | 38 | call vimtest#Quit() 39 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/lcs/t2010-FindAllCommon-minimumCommon.vim: -------------------------------------------------------------------------------- 1 | " Test find all common substrings with a minimum length. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 7 | \ ['myfoobar', 'thefooxy', 'theyfoobitch'], 3), 8 | \ [[['my', 'the', 'they'], ['bar', 'xy', 'bitch']], ['foo']], 9 | \ 'minimumCommonLength reached' 10 | \) 11 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 12 | \ ['myfoobar', 'thefooxy', 'theyfoobitch'], 4), 13 | \ [[['myfoobar', 'thefooxy', 'theyfoobitch']], []], 14 | \ 'minimumCommonLength missed' 15 | \) 16 | 17 | call vimtap#Is(ingo#list#lcs#FindAllCommon( 18 | \ ['metfooforbarby', 'havefootobasil', 'gotfooinbasin'], 3), 19 | \ [[['met', 'have', 'got'], ['forbarby', 'tobasil', 'inbasin']], ['foo']], 20 | \ 'minimumCommonLength filters out shorter' 21 | \) 22 | 23 | call vimtest#Quit() 24 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/pattern/t1000-AllItemsMatch.vim: -------------------------------------------------------------------------------- 1 | " Test AllItemsMatch. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#list#pattern#AllItemsMatch(['x'], 'x'), 1, 'single element is exact') 7 | call vimtap#Is(ingo#list#pattern#AllItemsMatch(['x'], 'Y'), 0, 'single element is different') 8 | 9 | call vimtap#Is(ingo#list#pattern#AllItemsMatch([1, 2, 3], '^.$'), 1, 'small digits are all single character') 10 | call vimtap#Is(ingo#list#pattern#AllItemsMatch([1, 22, 3], '^.$'), 0, 'digits are not all single character') 11 | call vimtap#Is(ingo#list#pattern#AllItemsMatch([11, 22, 33], '^.$'), 0, 'no digits are single character') 12 | 13 | call vimtap#Is(ingo#list#pattern#AllItemsMatch(['foo', 'fox', 'fozzy'], 'fo'), 1, 'all contain fo') 14 | call vimtap#Is(ingo#list#pattern#AllItemsMatch(['foo', 'fox', 'fozzy'], '\(.\)\1'), 0, 'all contain doubled character') 15 | 16 | call vimtap#Is(ingo#list#pattern#AllItemsMatch([], '^.$'), 1, 'empty list') 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/pattern/t1100-FirstMatchIndex.vim: -------------------------------------------------------------------------------- 1 | " Test FirstMatchIndex. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#list#pattern#FirstMatchIndex(['foo', 'fox', 'fozzy'], 'o[^o]'), 1, 'return first of two matching indices') 7 | call vimtap#Is(ingo#list#pattern#FirstMatchIndex(['foo', 'fox', 'fozzy'], 'noMatch'), -1, 'no matches return -1') 8 | call vimtap#Is(ingo#list#pattern#FirstMatchIndex([], '^'), -1, 'empty list with matching pattern returns -1') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/pattern/t1110-FirstMatch.vim: -------------------------------------------------------------------------------- 1 | " Test FirstMatch. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#list#pattern#FirstMatch(['foo', 'fox', 'fozzy'], 'o[^o]'), 'fox', 'return first of two matches') 7 | call vimtap#Is(ingo#list#pattern#FirstMatch(['foo', 'fox', 'fozzy'], 'noMatch'), '', 'no matches return empty String') 8 | call vimtap#Is(ingo#list#pattern#FirstMatch(['foo', 'fox', 'fozzy'], 'noMatch', 42), 42, 'no matches return custom noMatchValue') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/pattern/t1200-AllMatchIndices.vim: -------------------------------------------------------------------------------- 1 | " Test AllMatchIndices. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#list#pattern#AllMatchIndices(['foo', 'fox', 'fozzy'], 'o[^o]'), [1, 2], 'return two matching indices') 7 | call vimtap#Is(ingo#list#pattern#AllMatchIndices(['foo', 'fox', 'fozzy'], 'noMatch'), [], 'no matches return empty List') 8 | call vimtap#Is(ingo#list#pattern#AllMatchIndices([], '^'), [], 'empty list with matching pattern returns empty List') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/pattern/t1210-AllMatches.vim: -------------------------------------------------------------------------------- 1 | " Test AllMatches. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#list#pattern#AllMatches(['foo', 'fox', 'fozzy'], 'o[^o]'), ['fox', 'fozzy'], 'return two matches') 7 | call vimtap#Is(ingo#list#pattern#AllMatches(['foo', 'fox', 'fozzy'], 'noMatch'), [], 'no matches return empty List') 8 | 9 | let s:list = ['foo', 'fox', 'fozzy'] 10 | let s:inputList = copy(s:list) 11 | call ingo#list#pattern#AllMatches(s:inputList, 'o[^o]') 12 | call vimtap#Is(s:inputList, s:list, 'the original List is left untouched') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/sequence/t1010-FindCharacter.vim: -------------------------------------------------------------------------------- 1 | " Test find character sequences. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(11) 5 | 6 | call vimtap#Is(ingo#list#sequence#FindCharacter([]), [0, 0], 'empty list') 7 | call vimtap#Is(ingo#list#sequence#FindCharacter(['a']), [0, 0], 'single element list') 8 | call vimtap#Is(ingo#list#sequence#FindCharacter(['a', 123, 'c']), [0, 0], 'non-character element list') 9 | call vimtap#Is(ingo#list#sequence#FindCharacter(['a', 'foo', 'c']), [0, 0], 'non-single-character element list') 10 | 11 | call vimtap#Is(ingo#list#sequence#FindCharacter(['b', 'c']), [2, 1], 'b, c list') 12 | call vimtap#Is(ingo#list#sequence#FindCharacter(['c', 'i']), [2, 6], 'c, i list') 13 | call vimtap#Is(ingo#list#sequence#FindCharacter(['b', 'c', 'd']), [3, 1], 'b, c, d list') 14 | call vimtap#Is(ingo#list#sequence#FindCharacter(['c', 'e', 'g', 'i']), [4, 2], 'c, e, g, i list') 15 | 16 | call vimtap#Is(ingo#list#sequence#FindCharacter(['b', 'c', 'e']), [2, 1], 'b, c list with additional e') 17 | call vimtap#Is(ingo#list#sequence#FindCharacter(['c', 'e', 'g', 'i', 'f', 'z']), [4, 2], 'c, e, g, i list with additional f, z') 18 | 19 | call vimtap#Is(ingo#list#sequence#FindCharacter(['1', 3, '5']), [3, 2], 'list with number') 20 | 21 | call vimtest#Quit() 22 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/split/t1000-RemoveFromStartWhilePredicate.vim: -------------------------------------------------------------------------------- 1 | " Test split off elements from the start with predicate. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(14) 5 | 6 | let g:list = [] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, '0'), [], 'nothing removed from empty list') | call vimtap#Is(g:list, [], 'unchanged source list') 7 | let g:list = [] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, '1'), [], 'nothing removed from empty list') | call vimtap#Is(g:list, [], 'unchanged source list') 8 | 9 | let g:list = [1, 2, 3] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, '0'), [], 'nothing removed from list') | call vimtap#Is(g:list, [1, 2, 3], 'unchanged source list') 10 | let g:list = [1, 2, 3] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, '1'), [1, 2, 3], 'everything removed from list') | call vimtap#Is(g:list, [], 'emptied source list') 11 | 12 | let g:list = [1, 2, 3] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, 'v:val <= 2'), [1, 2], 'two elements removed from list with expression') | call vimtap#Is(g:list, [3], 'last element left in source list') 13 | function! MyPredicate( value ) 14 | return (a:value <= 2) 15 | endfunction 16 | let g:list = [1, 2, 3] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, function('MyPredicate')), [1, 2], 'two elements removed from list with Funcref') | call vimtap#Is(g:list, [3], 'last element left in source list') 17 | 18 | let g:list = [1, 2, 2, 3, 2, 1] | call vimtap#Is(ingo#list#split#RemoveFromStartWhilePredicate(g:list, 'v:val <= 2'), [1, 2, 2], 'three elements removed from list with expression, later matches are ignored') | call vimtap#Is(g:list, [3, 2, 1], 'elements left in source list') 19 | 20 | call vimtest#Quit() 21 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/list/t1000-AddNonEmpty.vim: -------------------------------------------------------------------------------- 1 | " Test add non-empty items. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(7) 5 | 6 | let s:list = [] 7 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, ''), [], 'Add empty String to empty List gives empty List') 8 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, []), [], 'Add empty List to empty List gives empty List') 9 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, ['']), [['']], 'Add List with empty String to empty List') 10 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, 42), [[''], 42], 'Add 42') 11 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, 'foobar'), [[''], 42, 'foobar'], 'Add foobar') 12 | 13 | let s:originalList = s:list 14 | call vimtap#Ok(ingo#list#AddNonEmpty(s:list, '') is# s:originalList, 'Add empty String to List gives same List') 15 | call vimtap#Is(ingo#list#AddNonEmpty(s:list, [[]]), [[''], 42, 'foobar', [[]]], 'Add List with empty List') 16 | 17 | call vimtest#Quit() 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/lists/t1000-StartsWith.vim: -------------------------------------------------------------------------------- 1 | " Test StartsWith. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(11) 5 | 6 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], []), 1, 'list starts with empty sublist') 7 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [1]), 1, 'list starts with same first element') 8 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [1, 2]), 1, 'list starts with same first elements') 9 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [1, 2, 3]), 1, 'list is identical with sublist') 10 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [1, 9]), 0, 'sublist differs in second element') 11 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [1, 2, 3, 4]), 0, 'sublist has more elements than list') 12 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], [9, 7, 5]), 0, 'sublist has different elements') 13 | call vimtap#Is(ingo#lists#StartsWith([1, 2, 3], ['a']), 0, 'sublist has different elements') 14 | 15 | call vimtap#Is(ingo#lists#StartsWith(['a', 'b', 'c'], ['a', 'b'], 0), 1, 'case-sensistive comparison with identical cases') 16 | call vimtap#Is(ingo#lists#StartsWith(['a', 'b', 'c'], ['a', 'B'], 0), 0, 'case-sensistive comparison with different case in second element') 17 | call vimtap#Is(ingo#lists#StartsWith(['a', 'b', 'c'], ['a', 'B'], 1), 1, 'case-insensistive comparison with different case in second element') 18 | 19 | call vimtest#Quit() 20 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/lnum/t1000-AddOffsetWithWrapping.vim: -------------------------------------------------------------------------------- 1 | " Test adding offsets with wrap-around. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(12) 5 | 6 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 1, 10), 3, 'simple add') 7 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 7, 10), 9, 'simple add') 8 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 8, 10), 10, 'simple add to max') 9 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 9, 10), 1, 'wrap-around') 10 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 13, 10), 5, 'more wrap-around') 11 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, 23, 10), 5, 'wrap-around twice') 12 | 13 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(5, -3, 10), 2, 'subtract') 14 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, -1, 10), 1, 'subtract to min') 15 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, -2, 10), 10, 'wrap-around') 16 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, -3, 10), 9, 'more wrap-around') 17 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, -13, 10), 9, 'wrap-around twice') 18 | call vimtap#Is(ingo#lnum#AddOffsetWithWrapping(2, -23, 10), 9, 'wrap-around thrice') 19 | 20 | call vimtest#Quit() 21 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/matches/t1000-Any.vim: -------------------------------------------------------------------------------- 1 | " Test matching any pattern. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#matches#Any('foobar', []), 1, 'matches no patterns') 7 | call vimtap#Is(ingo#matches#Any('foobar', ['xy']), 0, 'does not match only pattern xy') 8 | call vimtap#Is(ingo#matches#Any('foobar', ['o\+']), 1, 'matches only pattern o\+') 9 | call vimtap#Is(ingo#matches#Any('foobar', ['o\+', 'xy', '^.\{6}$']), 1, 'matches first pattern o\+') 10 | call vimtap#Is(ingo#matches#Any('foobar', ['xy', 'o\+', '^.\{6}$']), 1, 'matches second pattern o\+') 11 | call vimtap#Is(ingo#matches#Any('foobar', ['xy', 'X\+', '^.\{6}$']), 1, 'matches last pattern ^.\{6}$') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/matches/t1010-All.vim: -------------------------------------------------------------------------------- 1 | " Test matching all patterns. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(5) 5 | 6 | call vimtap#Is(ingo#matches#All('foobar', []), 1, 'matches no patterns') 7 | call vimtap#Is(ingo#matches#All('foobar', ['xy']), 0, 'does not match only pattern xy') 8 | call vimtap#Is(ingo#matches#All('foobar', ['o\+']), 1, 'matches only pattern o\+') 9 | call vimtap#Is(ingo#matches#All('foobar', ['o\+', 'xy', '^.\{6}$']), 0, 'does not match second pattern') 10 | call vimtap#Is(ingo#matches#All('foobar', ['^[fF]', 'o\+', '^.\{6}$']), 1, 'matches all three patterns') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/matches/t2000-CountMatches.vim: -------------------------------------------------------------------------------- 1 | " Test counting matches in text. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#matches#CountMatches('foobar', ''), 7, 'matches before / after every character with empty pattern') 7 | call vimtap#Is(ingo#matches#CountMatches('', 'o\+'), 0, 'no matches with empty text') 8 | call vimtap#Is(ingo#matches#CountMatches('our house is foobar', 'o\+'), 3, '3 occurrences of o\+ in String') 9 | call vimtap#Is(ingo#matches#CountMatches(['our', 'house', 'is', 'foobar'], 'o\+'), 3, '3 occurrences of o\+ in List') 10 | call vimtap#Is(ingo#matches#CountMatches('our house is foobar', '.*'), 1, '1 occurrence of .* with String') 11 | call vimtap#Is(ingo#matches#CountMatches(['our', 'house', 'is', 'foobar', ''], '.*'), 5, '5 of .* in 5-element List') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/capture/t1000-MakeCapturing.vim: -------------------------------------------------------------------------------- 1 | " Test conversion of capturing groups into non-capturing ones. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | call vimtap#Is(ingo#regexp#capture#MakeNonCapturing('^\(foo\|ba\(r\|la\|lo\)\)-\(no\%(hi\)\?\)'), '^\%(foo\|ba\%(r\|la\|lo\)\)-\%(no\%(hi\)\?\)', 'make all non-capturing') 7 | call vimtap#Is(ingo#regexp#capture#MakeNonCapturing('^\(foo\|ba\(r\|la\|lo\)\)-\(no\%(hi\)\?\)', [0, 2]), '^\%(foo\|ba\(r\|la\|lo\)\)-\%(no\%(hi\)\?\)', 'make some non-capturing') 8 | 9 | call vimtap#Is(ingo#regexp#capture#MakeCapturing('^\%(foo\|ba\%(r\|la\|lo\)\)-\%(no\(hi\)\?\)'), '^\(foo\|ba\(r\|la\|lo\)\)-\(no\(hi\)\?\)', 'make all capturing') 10 | call vimtap#Is(ingo#regexp#capture#MakeCapturing('^\%(foo\|ba\%(r\|la\|lo\)\)-\%(no\(hi\)\?\)', [0, 2]), '^\(foo\|ba\%(r\|la\|lo\)\)-\(no\(hi\)\?\)', 'make some capturing') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/collection/t1000-ToBranches.vim: -------------------------------------------------------------------------------- 1 | " Test conversion of a collection to branches. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(7) 5 | 6 | call vimtap#Is(ingo#regexp#collection#ToBranches(''), '', 'empty pattern') 7 | call vimtap#Is(ingo#regexp#collection#ToBranches('^foo bar$'), '^foo bar$', 'no collection') 8 | call vimtap#Is(ingo#regexp#collection#ToBranches('[abcAZ]'), '\%(a\|b\|c\|A\|Z\)', 'simple five-character collection') 9 | call vimtap#Is(ingo#regexp#collection#ToBranches('My [xy] is \([yY]\?\|ey\)'), 'My \%(x\|y\) is \(\%(y\|Y\)\?\|ey\)', 'two simple collections') 10 | call vimtap#Is(ingo#regexp#collection#ToBranches('[abc[:digit:]xyz[:space:][:lower:]]'), '\%(a\|b\|c\|[[:digit:]]\|x\|y\|z\|[[:space:]]\|[[:lower:]]\)', 'collection with multiple character classes') 11 | call vimtap#Is(ingo#regexp#collection#ToBranches('[abcA-EU-Zxyz<->]'), '\%(a\|b\|c\|[A-E]\|[U-Z]\|x\|y\|z\|[<->]\)', 'collection with multiple ranges') 12 | call vimtap#Is(ingo#regexp#collection#ToBranches('[^abc]'), '[^abc]', 'negative collection') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/deconstruct/t1000-RemovePositionAtoms.vim: -------------------------------------------------------------------------------- 1 | " Test removing position atoms. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(7) 5 | 6 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('foobar'), 'foobar', 'no position atoms') 7 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('fo\{1,10}bar\? .* l\([aeiou]\)ll\1'), 'fo\{1,10}bar\? .* l\([aeiou]\)ll\1', 'only various other atoms') 8 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('^fo\+bar$'), 'fo\+bar', 'beginning and end of line atoms') 9 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('\'), 'foobar', 'beginning and end of word atoms') 10 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('\%^file\%$'), 'file', 'beginning and end of file atoms') 11 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('the \%Vfoo\%V here'), 'the foo here', 'two visual area atoms') 12 | call vimtap#Is(ingo#regexp#deconstruct#RemovePositionAtoms('found \%10l\%>2chere\s.*\%<20v\%>''x'), 'found here\s.*', 'various line, column, mark atoms') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/deconstruct/t1100-RemoveMultis.vim: -------------------------------------------------------------------------------- 1 | " Test removing multis. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | call vimtap#Is(ingo#regexp#deconstruct#RemoveMultis('foobar'), 'foobar', 'no multis') 7 | call vimtap#Is(ingo#regexp#deconstruct#RemoveMultis('fo\{1,10}bar\? .* l\([aeiou]\)ll\1'), 'fobar . l\([aeiou]\)ll\1', '\? * \{} multis') 8 | call vimtap#Is(ingo#regexp#deconstruct#RemoveMultis('fo\{-}ba\{-1}r\{-,10} \{2,7}x\\{1,2}'), 'fobar x\\{1,2}', 'various \{} multis') 9 | call vimtap#Is(ingo#regexp#deconstruct#RemoveMultis('a\@<= foo\(bar\)\@=bar'), 'a foo\(bar\)bar', '\@= multis') 10 | 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/deconstruct/t2000-UnescapeSpecialCharacters.vim: -------------------------------------------------------------------------------- 1 | " Test unescaping of special characters. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('foobar'), 'foobar', 'no special characters') 7 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('^foo[bar]$'), '^foo[bar]$', 'keep regular atoms') 8 | 9 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('\^foo\[bar\]\$'), '^foo[bar]$', 'literal ^[]$') 10 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('f\~o\.\.\.b\*r'), 'f~o...b*r', 'literal ~.*') 11 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('/foo\\bar\\\\'), '/foo\bar\\', 'literal \') 12 | 13 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('\tfoo\r\nbar\e\e'), "\tfoo\r\nbar\e\e", 'special escape sequences') 14 | call vimtap#Is(ingo#regexp#deconstruct#UnescapeSpecialCharacters('\~\~fox\bob\\ar\*\*'), "~~fox\bob\\ar**", 'literals and escape sequences') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/deconstruct/t3000-ToQuasiLiteral.vim: -------------------------------------------------------------------------------- 1 | " Test converting to somewhat literal text. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | call vimtap#Is(ingo#regexp#deconstruct#ToQuasiLiteral('foobar'), 'foobar', 'no regexp, already literal text') 7 | call vimtap#Is(ingo#regexp#deconstruct#ToQuasiLiteral('fo*bar\?$'), 'fobar', 'simple regexp') 8 | call vimtap#Is(ingo#regexp#deconstruct#ToQuasiLiteral('^\'), 'fo[ox]\%(bar\|hos\)', 'medium-complexity regexp') 9 | call vimtap#Is(ingo#regexp#deconstruct#ToQuasiLiteral('^\%10lfo\{1,10}\~bar\?\n.*\t\$'), "fo~bar\n.\tl\\([aeiou]\\)ll\\1", 'complex regexp') 10 | 11 | call vimtest#Quit() 12 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1000-Project-basic.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of matched characters. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#regexp#length#Project(''), [0, 0], 'empty pattern') 7 | call vimtap#Is(ingo#regexp#length#Project('a'), [1, 1], 'single literal character') 8 | call vimtap#Is(ingo#regexp#length#Project('abc'), [3, 3], '3-character literal word') 9 | 10 | call vimtap#Is(ingo#regexp#length#Project('a\|xyz'), [1, 3], 'two literal branches') 11 | call vimtap#Is(ingo#regexp#length#Project('abc\|z'), [1, 3], 'two literal branches') 12 | call vimtap#Is(ingo#regexp#length#Project('a\|fghijklm\|xyz'), [1, 8], 'three literal branches') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1010-Project-multis.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of matched character multiple times with various multis. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(18) 5 | 6 | call vimtap#Is(ingo#regexp#length#Project('a*'), [0, 0x7FFFFFFF], '* multi') 7 | call vimtap#Is(ingo#regexp#length#Project('a\+'), [1, 0x7FFFFFFF], '\+ multi') 8 | call vimtap#Is(ingo#regexp#length#Project('a\?'), [0, 1], '\? multi') 9 | call vimtap#Is(ingo#regexp#length#Project('a\{2,5}'), [2, 5], '\{n,m} multi') 10 | call vimtap#Is(ingo#regexp#length#Project('a\{3}'), [3, 3], '\{n} multi') 11 | call vimtap#Is(ingo#regexp#length#Project('a\{3,}'), [3, 0x7FFFFFFF], '\{n,} multi') 12 | call vimtap#Is(ingo#regexp#length#Project('a\{,3}'), [0, 3], '\{,n} multi') 13 | call vimtap#Is(ingo#regexp#length#Project('a\{}'), [0, 0x7FFFFFFF], '\{} multi') 14 | call vimtap#Is(ingo#regexp#length#Project('a\{-2,5}'), [2, 5], '\{-n,m} multi') 15 | call vimtap#Is(ingo#regexp#length#Project('a\{-3}'), [3, 3], '\{-n} multi') 16 | call vimtap#Is(ingo#regexp#length#Project('a\{-3,}'), [3, 0x7FFFFFFF], '\{-n,} multi') 17 | call vimtap#Is(ingo#regexp#length#Project('a\{-,3}'), [0, 3], '\{-,n} multi') 18 | call vimtap#Is(ingo#regexp#length#Project('a\{-}'), [0, 0x7FFFFFFF], '\{-} multi') 19 | 20 | call vimtap#Is(ingo#regexp#length#Project('a\@>'), [1, 1], '\@> multi') 21 | call vimtap#Is(ingo#regexp#length#Project('a\@='), [0, 0], '\@= multi') 22 | call vimtap#Is(ingo#regexp#length#Project('a\@!'), [0, 0], '\@! multi') 23 | call vimtap#Is(ingo#regexp#length#Project('a\@<='), [0, 0], '\@<= multi') 24 | call vimtap#Is(ingo#regexp#length#Project('a\@'), [3, 3], '3-character keyword') 7 | call vimtap#Is(ingo#regexp#length#Project('^abc$'), [3, 3], '3-character anchored line') 8 | call vimtap#Is(ingo#regexp#length#Project('\%>10l\%<80vword\%$'), [4, 4], '4-character position-anchored word') 9 | 10 | call vimtap#Is(ingo#regexp#length#Project('foo\.\.\.'), [6, 6], 'word with ellipsis') 11 | call vimtap#Is(ingo#regexp#length#Project('\tThis is\tit\n'), [12, 12], 'sentence with tabs and newline') 12 | call vimtap#Is(ingo#regexp#length#Project('/\~-\~-\*-\*\\'), [9, 9], 'mix of escaped special characters') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1040-Project-collection.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of matched characters in patterns with collections. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | call vimtap#Is(ingo#regexp#length#Project('ab[cdef]'), [3, 3], 'word with one collection') 7 | call vimtap#Is(ingo#regexp#length#Project('[Aa]b\_[cdef]'), [3, 3], 'word with two collections, one the EOL variant') 8 | call vimtap#Is(ingo#regexp#length#Project('[Aa][Bc][Cc]'), [3, 3], 'three concatenated collections') 9 | 10 | call vimtap#Is(ingo#regexp#length#Project('ab\[cdef\]'), [8, 8], 'word with escaped collection characters') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1050-Project-global-flags.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of matched characters in patterns with global flags. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | call vimtap#Is(ingo#regexp#length#Project('\cfoo'), [3, 3], 'word with case-insensitive flag') 7 | call vimtap#Is(ingo#regexp#length#Project('\cf\Co\co\C'), [3, 3], 'word with multiple case-[in]sensitive flags') 8 | 9 | call vimtap#Is(ingo#regexp#length#Project('\%#=2foo'), [3, 3], 'word with regexp engine type flag') 10 | call vimtap#Is(ingo#regexp#length#Project('\%#=2\cfoo'), [3, 3], 'word with regexp engine type and case-insensitive flags') 11 | 12 | call vimtest#Quit() 13 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1090-Project-combinations.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of match length of complex patterns. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(7) 5 | 6 | call vimtap#Is(ingo#regexp#length#Project('nu\%(la\)\{2,5}'), [6, 12], '\{n,m} two-character group multi with prefix') 7 | call vimtap#Is(ingo#regexp#length#Project('fo\?\|nul\{2,5}am\|x\{3}'), [1, 9], 'three branches with multi ranges') 8 | call vimtap#Is(ingo#regexp#length#Project('fo\?\|nu\%(la\|y\)\{2,5}am\|x\{3}'), [1, 14], 'three branches, one with inner group with multi') 9 | call vimtap#Is(ingo#regexp#length#Project('fo\?\|nu\%(la\{1,2}\|y\)\{2,5}am\|x\{3}'), [1, 19], 'three branches, one with inner group with multi with multi') 10 | call vimtap#Is(ingo#regexp#length#Project('fo\?\|nu\%(\%(I\%(M\|NN\)\)\{1,2}\|y\)\{2,5}am\|x\{3}'), [1, 34], 'three branches, one with inner group with multi with inner group with multi') 11 | 12 | call vimtap#Is(ingo#regexp#length#Project('nul*am\|xu\?t'), [2, 0x7FFFFFFF], 'branches with * / \? multis with prefix and suffix') 13 | call vimtap#Is(ingo#regexp#length#Project('nul\{100,200}am\|xu\{10,99}t'), [12, 204], 'branches with \{n,m} multis with prefix and suffix') 14 | 15 | call vimtest#Quit() 16 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/length/t1100-Project-invalid.vim: -------------------------------------------------------------------------------- 1 | " Test estimation of invalid pattern. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(1) 5 | 6 | call vimtap#err#Throws('PrefixGroupsSuffix: Unmatched \(', "call ingo#regexp#length#Project('my\\%(Foo\\|B\\(ar\\|il\\|ox\\|Fox\\)Trott')", 'missing closing paren throws exception') 7 | 8 | call vimtest#Quit() 9 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t1000-TopLevelBranches.vim: -------------------------------------------------------------------------------- 1 | " Test splitting into top-level branches. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(13) 5 | 6 | call vimtap#Is(ingo#regexp#split#TopLevelBranches(''), [''], 'empty pattern') 7 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('foo'), ['foo'], 'simple atom') 8 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('foo\|bar'), ['foo', 'bar'], 'single branch') 9 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('foo\|bar\|baz'), ['foo', 'bar', 'baz'], 'three-element single branch') 10 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('\%(foo\|bar\|baz\)'), ['\%(foo\|bar\|baz\)'], 'single branch wrapped in group') 11 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('\%(foo\|bar\|baz\)\|me'), ['\%(foo\|bar\|baz\)', 'me'], 'nested branch front') 12 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('me\|\%(foo\|bar\|baz\)'), ['me', '\%(foo\|bar\|baz\)'], 'nested branch back') 13 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('\(me\|you\)\|\%(foo\|bar\|baz\)'), ['\(me\|you\)', '\%(foo\|bar\|baz\)'], 'two nested branches') 14 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('me\|\%(foo\|b\%(i\|o\|ou\|ei\)r\|baz\)'), ['me', '\%(foo\|b\%(i\|o\|ou\|ei\)r\|baz\)'], 'multiply nested branches') 15 | 16 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('\|me\|\%(foo\|bar\|\|baz\)\|'), ['', 'me', '\%(foo\|bar\|\|baz\)', ''], 'empty branches') 17 | 18 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('(me|you)\|\%(foo)\|b)|r\)\|ga)'), ['(me|you)', '\%(foo)\|b)|r\)', 'ga)'], 'unescaped parenthese and bars') 19 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('me\|\%(foo\|b\%(i\|o\|ou\|ei\|r\|baz\)'), ['me', '\%(foo\|b\%(i\|o\|ou\|ei\|r\|baz\)'], 'missing closing parentheses') 20 | call vimtap#Is(ingo#regexp#split#TopLevelBranches('me\|\%(foo\|b\%(i\|o\)\)\)\|ou\|ei\|r\|baz\)'), ['me', '\%(foo\|b\%(i\|o\)\)\)', 'ou', 'ei', 'r', 'baz\)'], 'too many closing parentheses') 21 | 22 | call vimtest#Quit() 23 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t2000-PrefixGroupsSuffix.vim: -------------------------------------------------------------------------------- 1 | " Test splitting prefix, group(s), suffix. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(9) 5 | 6 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix(''), [''], 'empty pattern') 7 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('foo'), ['foo'], 'simple literal pattern') 8 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('Foo\|Bar\|Fox'), ['Foo\|Bar\|Fox'], 'toplevel branches without group') 9 | 10 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('\%(Foo\|Bar\|Fox\)'), ['', 'Foo\|Bar\|Fox', ''], 'group with branches') 11 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('my\%(Foo\|Bar\|Fox\)Trott'), ['my', 'Foo\|Bar\|Fox', 'Trott'], 'group with branches inside literal prefix and suffix') 12 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('my\%(Foo\|Bar\|Fox\)In\(Our\|Their\)Trott'), ['my', 'Foo\|Bar\|Fox', 'In', 'Our\|Their', 'Trott'], 'two groups surrounded by literals') 13 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('\%(Foo\|Bar\|Fox\)\(Our\|Their\)'), ['', 'Foo\|Bar\|Fox', '', 'Our\|Their', ''], 'two groups unsurrounded') 14 | 15 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('my\%(Foo\|B\(ar\|il\|ox\)\|Fox\)Trott'), ['my', 'Foo\|B\(ar\|il\|ox\)\|Fox', 'Trott'], 'group with another group inside') 16 | call vimtap#Is(ingo#regexp#split#PrefixGroupsSuffix('my\%(F\(al\)\?oo\|B\(ar\|il\|ox\)\|\(F\|\%(Var\)\?i\)ox\)Trott'), ['my', 'F\(al\)\?oo\|B\(ar\|il\|ox\)\|\(F\|\%(Var\)\?i\)ox', 'Trott'], 'group with other groups inside') 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t2090-PrefixGroupsSuffix-invalid.vim: -------------------------------------------------------------------------------- 1 | " Test splitting prefix, group(s), suffix of invalid pattern. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | call vimtap#err#Throws('PrefixGroupsSuffix: Unmatched \(', "call ingo#regexp#split#PrefixGroupsSuffix('my\\%(Foo\\|B\\(ar\\|il\\|ox\\|Fox\\)Trott')", 'missing closing paren throws exception') 7 | call vimtap#err#Throws('PrefixGroupsSuffix: Unmatched \)', "call ingo#regexp#split#PrefixGroupsSuffix('my\\%(Foo\\|B\\(ar\\|il\\)\\|ox\\)\\|Fox\\)Trott')", 'missing opening paren throws exception') 8 | 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t3000-AddPatternByProjectedMatchLength-literals.vim: -------------------------------------------------------------------------------- 1 | " Test addition of literal patterns based on length. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength([], 'foo'), ['foo'], 'add literal pattern to empty list') 7 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['foo'], 'fo'), ['foo', 'fo'], 'add shorter literal pattern to one-element list') 8 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['foo'], 'fooy'), ['fooy', 'foo'], 'add longer literal pattern to one-element list') 9 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['foo'], 'fox'), ['foo', 'fox'], 'add same-length literal pattern to one-element list') 10 | 11 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['foo', 'fo'], 'f'), ['foo', 'fo', 'f'], 'add shorter literal pattern to two-element list') 12 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['fooxies', 'fo'], 'foox'), ['fooxies', 'foox', 'fo'], 'add literal pattern to middle of two-element list') 13 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['fooxies', 'foox', 'fo'], 'foo'), ['fooxies', 'foox', 'foo', 'fo'], 'add literal pattern to middle of three-element list') 14 | 15 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['fooxies', 'fo', 'boobies', 'bo'], 'boo'), ['fooxies', 'boo', 'fo', 'boobies', 'bo'], 'add literal pattern to middle of not fully sorted four-element list') 16 | 17 | call vimtest#Quit() 18 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t3010-AddPatternByProjectedMatchLength-minmax.vim: -------------------------------------------------------------------------------- 1 | " Test considering min or max length. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['abcd\+', 'abc\+', 'ab\+', 'a\+', '0*'], 'ooo'), ['abcd\+', 'abc\+', 'ooo', 'ab\+', 'a\+', '0*'], 'add ooo to staggered multis behind max=3') 7 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['abcd\+', 'abc\+', 'ab\+', 'a\+', '0*'], 'ooo\+'), ['abcd\+', 'abc\+', 'ooo\+', 'ab\+', 'a\+', '0*'], 'add ooo\+ to staggered multis behind max=3') 8 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['abcd\+', 'abc\+', 'ab\+', 'a\+', '0*'], 'o\{2,4}'), ['abcd\+', 'abc\+', 'ab\+', 'o\{2,4}', 'a\+', '0*'], 'add o\{2,4} to staggered multis behind max=2') 9 | 10 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['a\{6,9}', 'b\{5,7}', 'c\{2,5}', 'd\{1,3}'], 'oooooo'), ['a\{6,9}', 'b\{5,7}', 'oooooo', 'c\{2,5}', 'd\{1,3}'], 'add ooooo to staged ranges') 11 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['a\{6,9}', 'b\{5,7}', 'c\{2,5}', 'd\{1,3}'], 'o\{6}'), ['a\{6,9}', 'b\{5,7}', 'o\{6}', 'c\{2,5}', 'd\{1,3}'], 'add o\{6} to various ranges') 12 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['a\{6,9}', 'b\{5,7}', 'c\{2,5}', 'd\{1,3}'], 'o\{4,8}'), ['a\{6,9}', 'b\{5,7}', 'c\{2,5}', 'o\{4,8}', 'd\{1,3}'], 'o\{4,8} uses min to sort in max values') 13 | 14 | call vimtest#Quit() 15 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/split/t3090-AddPatternByProjectedMatchLength-invalid.vim: -------------------------------------------------------------------------------- 1 | " Test addition of/to invalid patterns. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['fooxies', 'f\%(Foo\|B\(ar\|il\|ox\|Fox\)Trott', 'fo'], 'foo'), ['fooxies', 'f\%(Foo\|B\(ar\|il\|ox\|Fox\)Trott', 'foo', 'fo'], 'add, skip invalid pattern') 7 | call vimtap#Is(ingo#regexp#split#AddPatternByProjectedMatchLength(['fooxies', 'fo'], 'f\%(Foo\|B\(ar\|il\|ox\|Fox\)Trott'), ['fooxies', 'fo', 'f\%(Foo\|B\(ar\|il\|ox\|Fox\)Trott'], 'invalid pattern added at end') 8 | 9 | call vimtest#Quit() 10 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/regexp/t1000-IsValid.vim: -------------------------------------------------------------------------------- 1 | " Test testing regular expression for correctness. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#regexp#IsValid(''), 1, 'empty pattern is valid') 7 | call vimtap#Is(ingo#regexp#IsValid('foo'), 1, 'literal pattern is valid') 8 | call vimtap#Is(ingo#regexp#IsValid('^[fF]o\+$'), 1, 'simple pattern is valid') 9 | 10 | call vimtap#Is(ingo#regexp#IsValid('fo**'), 0, 'fo** is invalid') 11 | call vimtap#Like(ingo#err#Get(), '^E871:', "fo** gives E871: (NFA regexp) Can't have a multi follow a multi") 12 | 13 | call ingo#err#Clear() 14 | call vimtap#Is(ingo#regexp#IsValid('foo\(bar', 'custom'), 0, 'foo\(bar is invalid') 15 | call vimtap#Is(ingo#err#Get(), '', 'custom error context keeps default context') 16 | call vimtap#Like(ingo#err#Get('custom'), '^E54:', "fo** gives E54: Unmatched \(") 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/str/t1000-Trim.vim: -------------------------------------------------------------------------------- 1 | " Test removal of leading and trailing whitespace. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(6) 5 | 6 | call vimtap#Is(ingo#str#Trim(''), '', 'no-op on empty string') 7 | call vimtap#Is(ingo#str#Trim('foo bar'), 'foo bar', 'no surrounding whitespace, inner kept intact') 8 | call vimtap#Is(ingo#str#Trim(' foo bar'), 'foo bar', 'remove just from front') 9 | call vimtap#Is(ingo#str#Trim('foo bar '), 'foo bar', 'remove just from back') 10 | call vimtap#Is(ingo#str#Trim("\t\t foo\tbar \t "), "foo\tbar", 'remove mixed surrounding whitespace') 11 | call vimtap#Is(ingo#str#Trim("\n\nfoo\n\nbar\n"), "foo\n\nbar", 'remove surrounding newlines') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/str/t1100-TrimPattern.vim: -------------------------------------------------------------------------------- 1 | " Test removal of leading and trailing pattern. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(5) 5 | 6 | call vimtap#Is(ingo#str#TrimPattern('', '[xX]\+'), '', 'no-op on empty string') 7 | call vimtap#Is(ingo#str#TrimPattern('fox bar', '[xX]\+'), 'fox bar', 'no surrounding matches, inner kept intact') 8 | call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXx', '[xX]\+'), 'fox bar', 'remove surrounding matches') 9 | 10 | call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXxX', 'x\+', 'X\+'), 'XxXfox barXx', 'use different patterns for leading and trailing matches') 11 | call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXx', '[uU]\+', '[xX]\+'), 'xXxXfox bar', 'only trailing pattern matches') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/strdisplaywidth/pad/t1000-Repeat.vim: -------------------------------------------------------------------------------- 1 | " Test duplicate to exceed width. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(10) 5 | 6 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('', 1), '', 'empty text') 7 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('x', 5), 'xxxxx', 'single-width text') 8 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('Abc', 1), 'Abc', 'text longer than enough') 9 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('Abc', 3), 'Abc', 'text exactly long enough') 10 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('Abc', 4), 'AbcAbc', 'need one duplication to exceed') 11 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('Abc', 6), 'AbcAbc', 'need one duplication to match') 12 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('Abc', 7), 'AbcAbcAbc', 'need two duplications to exceed') 13 | 14 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat('', 5), '', 'double-width text') 15 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat("\t\t", 10), ' ', 'two tabs text are rendered as spaces') 16 | call vimtap#Is(ingo#strdisplaywidth#pad#Repeat("|\t", 10), '| | ', 'char+tab text is duplicated') 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/strdisplaywidth/pad/t1100-RepeatExact.vim: -------------------------------------------------------------------------------- 1 | " Test duplicate to exactly match width. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(10) 5 | 6 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('', 1), ' ', 'empty text') 7 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('x', 5), 'xxxxx', 'single-width text') 8 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('Abc', 1), 'A', 'text longer than enough') 9 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('Abc', 3), 'Abc', 'text exactly long enough') 10 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('Abc', 4), 'AbcA', 'need one duplication to exceed') 11 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('Abc', 6), 'AbcAbc', 'need one duplication to match') 12 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('Abc', 7), 'AbcAbcA', 'need two duplications to exceed') 13 | 14 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('', 5), ' ', 'double-width text') 15 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact("\t\t", 10), ' ', 'two tabs text are rendered as spaces') 16 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact("|\t", 10), '| | ', 'char+tab text is duplicated') 17 | 18 | call vimtest#Quit() 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/strdisplaywidth/pad/t1110-RepeatExact-filler.vim: -------------------------------------------------------------------------------- 1 | " Test duplicate to exactly match width with custom filler. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(3) 5 | 6 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('', 2, 'x'), 'xx', 'empty text') 7 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact('', 5, '.'), '.', 'double-width text') 8 | call vimtap#Is(ingo#strdisplaywidth#pad#RepeatExact("\t\t", 10), ' ', 'two tabs text are rendered as spaces, no filler necessary') 9 | 10 | call vimtest#Quit() 11 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/strdisplaywidth/t1000-strleft.vim: -------------------------------------------------------------------------------- 1 | " Test extracting a certain width from left. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(8) 5 | 6 | call vimtap#Is(ingo#strdisplaywidth#strleft('foobar', 2), 'fo', '2 single-width characters') 7 | call vimtap#Is(ingo#strdisplaywidth#strleft('foobar', 9), 'foobar', 'width exceeds actual one') 8 | call vimtap#Is(ingo#strdisplaywidth#strleft('foobar', 0), '', 'zero width') 9 | 10 | call vimtap#Is(ingo#strdisplaywidth#strleft('fbar', 2), 'f', 'double-width character in the middle is excluded') 11 | call vimtap#Is(ingo#strdisplaywidth#strleft('fbar', 3), 'f', 'include double-width character') 12 | call vimtap#Is(ingo#strdisplaywidth#strleft('fbar', 4), 'f', 'double-width character in the middle is excluded') 13 | call vimtap#Is(ingo#strdisplaywidth#strleft("f\tbar", 3), 'f', 'tab in the middle is excluded') 14 | call vimtap#Is(ingo#strdisplaywidth#strleft("f\t\tbar", 8), "f\t", 'include tab') 15 | 16 | call vimtest#Quit() 17 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/subs/BraceCreation/t1010-BraceCreation-options.vim: -------------------------------------------------------------------------------- 1 | " Test brace creation with options. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(7) 5 | 6 | function! s:Call( text, options ) 7 | return ingo#subs#BraceCreation#FromSplitString(a:text, '', a:options) 8 | endfunction 9 | 10 | call vimtap#Is(s:Call('abc def zyz', {}), '{abc,def,zyz}', 'no common substrings') 11 | call vimtap#Is(s:Call('abc def zyz', {'returnValueOnFailure' : ''}), '', 'no common substrings') 12 | 13 | call vimtap#Is(s:Call('FooHasBoo FooBoo FooBox', {}), 'Foo{Has,,}Bo{o,o,x}', 'optional inner default') 14 | call vimtap#Is(s:Call('FooHasBoo FooBoo FooBox', {'optionalElementInSquareBraces': 1}), 'Foo[Has]Bo{o,o,x}', 'optional inner in square braces') 15 | call vimtap#Is(s:Call('FooHasBoo FooBoo FooBox', {'uniqueElements': 1}), 'Foo{Has,}Bo{o,x}', 'unique') 16 | call vimtap#Is(s:Call('FooHasBoo FooBoo FooBox', {'uniqueElements': 1, 'optionalElementInSquareBraces': 1}), 'Foo[Has]Bo{o,x}', 'unique and square braces') 17 | call vimtap#Is(s:Call('FooHasBoo FooBoo FooBox', {'short': 1}), 'Foo[Has]Bo{o,x}', 'short = unique and square braces') 18 | 19 | call vimtest#Quit() 20 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/subs/BraceCreation/t1030-BraceCreation-0numbers.vim: -------------------------------------------------------------------------------- 1 | " Test brace creation with 0-prefixed numbers. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(4) 5 | 6 | function! s:Call( text ) 7 | return ingo#subs#BraceCreation#FromSplitString(a:text) 8 | endfunction 9 | 10 | call vimtap#Is(s:Call('foo1 foo2 foo3'), 'foo{1..3}', 'single digit number sequence') 11 | call vimtap#Is(s:Call('foo01 foo02 foo03'), 'foo0{1..3}', 'single digit 0-number sequence') 12 | call vimtap#Is(s:Call('foo06 foo08 foo10 foo12'), 'foo{06..12..2}', '1-2 digit 0-number sequence') 13 | call vimtap#Is(s:Call('foo005 foo056 foo107 foo158'), 'foo{005..158..51}', '1-3 digit 0-number sequence') 14 | 15 | call vimtest#Quit() 16 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/subs/BraceExpansion/t1010-BraceExpansion-options.vim: -------------------------------------------------------------------------------- 1 | " Test brace expansion with options. 2 | 3 | call vimtest#StartTap() 4 | call vimtap#Plan(2) 5 | 6 | function! s:Call( text, options ) 7 | return ingo#subs#BraceExpansion#ExpandToString(a:text, ' ', a:options) 8 | endfunction 9 | 10 | call vimtap#Is(s:Call('Foo{Has,}Bo{o,o,x}', {}), 'FooHasBoo FooHasBoo FooHasBox FooBoo FooBoo FooBox', 'optional inner in default curly braces') 11 | call vimtap#Is(s:Call('Foo[Has]Bo{o,o,x}', {'optionalElementInSquareBraces': 1}), 'FooHasBoo FooHasBoo FooHasBox FooBoo FooBoo FooBox', 'optional inner in square braces') 12 | 13 | call vimtest#Quit() 14 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/subs/BraceExpansion/t1030-BraceExpansion-sequences.vim: -------------------------------------------------------------------------------- 1 | " Test brace expansion of sequences. 2 | 3 | function! s:Call( text ) 4 | return join(ingo#subs#BraceExpansion#ExpandStrict(a:text), ' ') 5 | endfunction 6 | 7 | call vimtest#StartTap() 8 | call vimtap#Plan(6) 9 | 10 | call vimtap#Is(s:Call('foo{1..10}'), 'foo1 foo2 foo3 foo4 foo5 foo6 foo7 foo8 foo9 foo10', 'same prefix, number sequence') 11 | call vimtap#Is(s:Call('foo{01..10}'), 'foo01 foo02 foo03 foo04 foo05 foo06 foo07 foo08 foo09 foo10', 'same prefix, 0-padded start number') 12 | call vimtap#Is(s:Call('foo{001..10}'), 'foo001 foo002 foo003 foo004 foo005 foo006 foo007 foo008 foo009 foo010', 'same prefix, 00-padded start number') 13 | call vimtap#Is(s:Call('foo{1..010}'), 'foo001 foo002 foo003 foo004 foo005 foo006 foo007 foo008 foo009 foo010', 'same prefix, 0-padded end number') 14 | call vimtap#Is(s:Call('foo{01..010}'), 'foo001 foo002 foo003 foo004 foo005 foo006 foo007 foo008 foo009 foo010', 'same prefix, 0-padded start and end number') 15 | call vimtap#Is(s:Call('foo{00..100..010}'), 'foo000 foo010 foo020 foo030 foo040 foo050 foo060 foo070 foo080 foo090 foo100', 'same prefix, 00-padded start number, 0-padded step') 16 | 17 | call vimtest#Quit() 18 | 19 | -------------------------------------------------------------------------------- /plugins/vim-ingo-library/tests/subst/expr/t1000-emulation.vim: -------------------------------------------------------------------------------- 1 | " Test substition with replacement emulation. 2 | 3 | function! s:IsEquivalent( expr, pat, sub, description ) 4 | call vimtap#Is(ingo#subst#expr#emulation#Substitute(a:expr, a:pat, a:sub, ''), substitute(a:expr, a:pat, a:sub, ''), a:description) 5 | call vimtap#Is(ingo#subst#expr#emulation#Substitute(a:expr, a:pat, a:sub, 'g'), substitute(a:expr, a:pat, a:sub, 'g'), 'global ' . a:description) 6 | endfunction 7 | 8 | call vimtest#StartTap() 9 | call vimtap#Plan(22) 10 | 11 | call s:IsEquivalent('foobar', '[ao]', 'x', 'normal substitution') 12 | call s:IsEquivalent('foobar', '[ao]', '\=toupper(submatch(0))', 'expression with submatch(0)') 13 | call s:IsEquivalent('foobar', '\([ao]\)[ao]\?', '\=toupper(submatch(1))', 'expression with submatch(1)') 14 | call s:IsEquivalent('this foo bar', '\<\(.\)\(.\)\(.\)\>', '\=submatch(3).submatch(2).submatch(2).submatch(1)', 'expression with many submatches') 15 | 16 | call s:IsEquivalent('my foo your bar my baz your hihi', 'my \zs\<...\>', '\=toupper(submatch(0))', 'with \zs') 17 | call s:IsEquivalent('my foo your bar my baz your hihi', '\<...\>\ze my', '\=toupper(submatch(0))', 'with \ze') 18 | call s:IsEquivalent('my foo. your bar! my baz. your hihi.', 'my \zs\<...\>\ze[.!]', '\=toupper(submatch(0))', 'with \zs and \ze') 19 | 20 | call s:IsEquivalent('foo can and foo cannot foo', '^foo\s', '\=toupper(submatch(0))', 'with ^ anchor') 21 | call s:IsEquivalent('foo foo can and foo cannot foo', '^foo\s', '\=toupper(submatch(0))', 'with ^ anchor') 22 | call s:IsEquivalent('foo can and foo cannot foo', '\sfoo$', '\=toupper(submatch(0))', 'with $ anchor') 23 | call s:IsEquivalent('foo can and foo cannot foo foo', '\sfoo$', '\=toupper(submatch(0))', 'with $ anchor') 24 | 25 | call vimtest#Quit() 26 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marco Hinz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/image/sayonara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/vim-sayonara/image/sayonara.png -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/README.adoc: -------------------------------------------------------------------------------- 1 | This directory contains some really simple tests that are meant to be run 2 | manually via: 3 | 4 | $ vim -u test/test_foo.vim 5 | 6 | They simply set up certain buffer/window/tabpage configurations that sayonara 7 | should be able to handle. 8 | 9 | :Sayonara is mapped to 'gs' 10 | :Sayonara! is mapped to 'gS' 11 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/file.txt: -------------------------------------------------------------------------------- 1 | file 1 2 | file 1 3 | file 1 4 | file 1 5 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/file2.txt: -------------------------------------------------------------------------------- 1 | file 2 2 | file 2 3 | file 2 4 | file 2 5 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/init.vim: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | source plugin/sayonara.vim 4 | 5 | nnoremap gs :Sayonara 6 | nnoremap gS :Sayonara! 7 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/test_2tab_1win_2buf.vim: -------------------------------------------------------------------------------- 1 | source test/init.vim 2 | 3 | silent! edit test/file.txt 4 | silent! edit test/file2.txt 5 | tabnew 6 | silent! edit test/file.txt 7 | silent! edit test/file2.txt 8 | -------------------------------------------------------------------------------- /plugins/vim-sayonara/test/test_2tab_4win_1buf.vim: -------------------------------------------------------------------------------- 1 | source test/init.vim 2 | 3 | silent edit test/file.txt 4 | split 5 | vsplit 6 | wincmd j 7 | vsplit 8 | 9 | silent tabnew test/file.txt 10 | split 11 | vsplit 12 | wincmd j 13 | vsplit 14 | -------------------------------------------------------------------------------- /plugins/vim-smartword/.gitignore: -------------------------------------------------------------------------------- 1 | .vim-flavor 2 | Gemfile.lock 3 | VimFlavor.lock 4 | -------------------------------------------------------------------------------- /plugins/vim-smartword/.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.1 4 | script: rake ci 5 | -------------------------------------------------------------------------------- /plugins/vim-smartword/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'vim-flavor', '~> 2.0' 4 | -------------------------------------------------------------------------------- /plugins/vim-smartword/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | 3 | task :ci => [:dump, :test] 4 | 5 | task :dump do 6 | sh 'vim --version' 7 | end 8 | 9 | task :test do 10 | sh 'bundle exec vim-flavor test' 11 | end 12 | -------------------------------------------------------------------------------- /plugins/vim-smartword/VimFlavor: -------------------------------------------------------------------------------- 1 | # No dependencies. 2 | -------------------------------------------------------------------------------- /plugins/vim-smartword/t/customized-basic-motions.vim: -------------------------------------------------------------------------------- 1 | runtime! plugin/smartword.vim 2 | 3 | function! Repeated(motion) 4 | let ps = [] 5 | call add(ps, [line('.'), col('.')]) 6 | while !0 7 | execute 'normal' a:motion 8 | let p = [line('.'), col('.')] 9 | if p == ps[-1] 10 | return ps 11 | endif 12 | call add(ps, p) 13 | endwhile 14 | endfunction 15 | 16 | describe 'vim-smartword' 17 | before 18 | new 19 | map [w] (smartword-w) 20 | noremap (smartword-basic-w) W 21 | map [b] (smartword-b) 22 | noremap (smartword-basic-b) B 23 | map [e] (smartword-e) 24 | noremap (smartword-basic-e) E 25 | map [ge] (smartword-ge) 26 | noremap (smartword-basic-ge) gE 27 | 0 read t/fixtures/sample.txt 28 | end 29 | 30 | after 31 | close! 32 | end 33 | 34 | describe '(smartword-basic-w)' 35 | it 'is used as a basic motion for (smartword-w)' 36 | normal! 1G0 37 | Expect Repeated('[w]') == [[1, 1], [1, 9], [1, 21], [1, 23]] 38 | end 39 | end 40 | 41 | describe '(smartword-basic-b)' 42 | it 'is used as a basic motion for (smartword-b)' 43 | normal! 1G$ 44 | Expect Repeated('[b]') == [[1, 23], [1, 21], [1, 9], [1, 1]] 45 | end 46 | end 47 | 48 | describe '(smartword-basic-e)' 49 | it 'is used as a basic motion for (smartword-e)' 50 | normal! 1G0 51 | Expect Repeated('[e]') == [[1, 1], [1, 7], [1, 23]] 52 | end 53 | end 54 | 55 | describe '(smartword-basic-ge)' 56 | it 'is used as a basic motion for (smartword-ge)' 57 | normal! 1G$ 58 | Expect Repeated('[ge]') == [[1, 23], [1, 7], [1, 1]] 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /plugins/vim-smartword/t/fixtures/multiple-lines.vim: -------------------------------------------------------------------------------- 1 | function! TestFunction 2 | echo 123456 3 | endfunction 4 | -------------------------------------------------------------------------------- /plugins/vim-smartword/t/fixtures/sample.txt: -------------------------------------------------------------------------------- 1 | aaa-bbb ccc_ddd- -- eee 2 | -------------------------------------------------------------------------------- /plugins/vim-smartword/t/multiple-lines.vim: -------------------------------------------------------------------------------- 1 | runtime! plugin/smartword.vim 2 | 3 | describe '(smartword-w)' 4 | before 5 | new 6 | map [w] (smartword-w) 7 | 0 read t/fixtures/multiple-lines.vim 8 | end 9 | 10 | after 11 | close! 12 | end 13 | 14 | context 'combined with the d operator' 15 | it 'smartly deletes a word followed by non-indented word' 16 | normal! 2GW 17 | Expect [line('.'), col('.')] == [2, 8] 18 | 19 | let @- = '...' 20 | normal d[w] 21 | Expect [line('.'), col('.'), @-] == [2, 7, '123456'] 22 | end 23 | 24 | it 'smartly deletes a word followed by indented word' 25 | normal! 1GW 26 | Expect [line('.'), col('.')] == [1, 11] 27 | 28 | let @- = '...' 29 | normal d[w] 30 | Expect [line('.'), col('.'), @-] ==# [1, 10, 'TestFunction'] 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /plugins/vim-smartword/t/ui.vim: -------------------------------------------------------------------------------- 1 | runtime! plugin/smartword.vim 2 | 3 | function! ListAvailableModes(lhs) 4 | let modes = ['n', 'x', 's', 'o', 'i', 'c', 'l'] 5 | call filter(modes, 'maparg(' . string(a:lhs) . ', v:val) != ""') 6 | return modes 7 | endfunction 8 | 9 | describe 'vim-smartinput' 10 | it 'provides UI key mappings' 11 | let movement_modes = ['n', 'x', 's', 'o'] 12 | Expect ListAvailableModes('(smartword-w)') ==# movement_modes 13 | Expect ListAvailableModes('(smartword-b)') ==# movement_modes 14 | Expect ListAvailableModes('(smartword-e)') ==# movement_modes 15 | Expect ListAvailableModes('(smartword-ge)') ==# movement_modes 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /plugins/wildfire.vim/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Giacomo Comitti 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /plugins/wildfire.vim/_assets/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/wildfire.vim/_assets/preview.gif -------------------------------------------------------------------------------- /plugins/wildfire.vim/_assets/quickselect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/plugins/wildfire.vim/_assets/quickselect.gif -------------------------------------------------------------------------------- /plugins/wildfire.vim/autoload/wildfire/triggers.vim: -------------------------------------------------------------------------------- 1 | 2 | let s:triggers = [] 3 | 4 | fu! wildfire#triggers#All() 5 | return s:triggers 6 | endfu 7 | 8 | fu! wildfire#triggers#Add(trigger, objects) 9 | let s:triggers = add(s:triggers, a:trigger) 10 | let objects = substitute(string(a:objects), "|", '\\|', "g") 11 | exe "nnoremap " a:trigger ":call wildfire#Start(v:count1, ". objects .")" 12 | exe "onoremap " a:trigger ":call wildfire#Start(v:count1, ". objects .")" 13 | exe "vnoremap " a:trigger ":call wildfire#Fuel(v:count1)" 14 | endfu 15 | 16 | fu! wildfire#triggers#AddQs(trigger, objects) 17 | let s:triggers = add(s:triggers, a:trigger) 18 | let objects = substitute(string(a:objects), "|", '\\|', "g") 19 | exe "nnoremap " a:trigger ":call wildfire#QuickSelect(". objects .")" 20 | exe "onoremap " a:trigger ":call wildfire#QuickSelect(". objects .")" 21 | endfu 22 | -------------------------------------------------------------------------------- /runtime/autoload/vem/debug.vim: -------------------------------------------------------------------------------- 1 | " Description: debug functions for Vem 2 | 3 | " display all elements of the current runtimepath in new buffer 4 | function! vem#debug#show_runtimepath() abort 5 | enew 6 | put=execute('echo &runtimepath') 7 | %s/,/\r/g 8 | g/^$/d 9 | endfunction 10 | 11 | " display non-vem key mappings in new buffer 12 | function! vem#debug#show_non_vem_keymappings() abort 13 | enew 14 | put=execute('map') 15 | 16 | " delete empty lines 17 | g/^$/d 18 | 19 | " delete definitions 20 | g/^.../d 21 | 22 | " delete select mode key mappings 23 | g/^s/d 24 | 25 | " delete Vem key mappings 26 | g/\ vem#/d 27 | g/vem_/d 28 | endfunction 29 | 30 | -------------------------------------------------------------------------------- /runtime/autoload/vem/insert.vim: -------------------------------------------------------------------------------- 1 | " Description: insert mode functions for Vem 2 | 3 | " insert tab at the beginning of line or after whitespace 4 | " complete word otherwhise 5 | " direction: 'next' | 'prev' 6 | function! vem#insert#smarttab(direction) abort 7 | " insert tab after whitespace 8 | let col = col('.') - 1 9 | if !col || getline('.')[col - 1] =~# '\s' 10 | return "\" 11 | endif 12 | 13 | " complete otherwise 14 | return a:direction == 'next' ? "\" : "\" 15 | endfunction 16 | 17 | -------------------------------------------------------------------------------- /runtime/autoload/vem/move.vim: -------------------------------------------------------------------------------- 1 | 2 | " check if the visual selection is a one character and characterwise one 3 | function! vem#move#selection_started() abort 4 | let charwise = mode() ==# "v" 5 | let same_pos = getpos("v") == getpos(".") 6 | return charwise && same_pos 7 | endfunction 8 | 9 | " jump to the beginning/end of the last edited text 10 | function! vem#move#jump_to_last_edited_text_end() abort 11 | if getpos(".") == getpos("']") 12 | return "`[" 13 | else 14 | return "`]" 15 | endif 16 | endfunction 17 | 18 | " jump to the beginning/end of the last selected text 19 | function! vem#move#jump_to_last_selected_text_end() abort 20 | if getpos(".") == getpos("'>") 21 | return "`<" 22 | else 23 | return "`>" 24 | endif 25 | endfunction 26 | 27 | -------------------------------------------------------------------------------- /src/custom-conf.vim: -------------------------------------------------------------------------------- 1 | " Vem: custom configuration 2 | 3 | """ System Configuration 4 | """""""""""""""""""""""" 5 | 6 | let g:vem_system_dir = '/etc/vem/' 7 | let s:vem_system_rc = g:vem_system_dir . 'vemrc' 8 | if filereadable(s:vem_system_rc) 9 | exec 'source ' . s:vem_system_rc 10 | endif 11 | 12 | 13 | """ User Configuration 14 | """""""""""""""""""""" 15 | 16 | let s:vem_user_rc = g:vem_user_dir . 'vemrc' 17 | if filereadable(s:vem_user_rc) 18 | exec 'source ' . s:vem_user_rc 19 | endif 20 | 21 | -------------------------------------------------------------------------------- /src/mappings/buffers.vim: -------------------------------------------------------------------------------- 1 | " Vem: buffers 2 | 3 | " New buffer 4 | noremap vem_new_buffer- :enew 5 | 6 | " Open buffer 7 | noremap vem_file_browser- :FileBeagleBufferDir 8 | noremap vem_fuzzy_finder- :CtrlP 9 | noremap vem_mru- :CtrlPMRUFiles 10 | noremap vem_open_file_under_cursor- gf 11 | 12 | " Save buffer 13 | noremap vem_save- empty(bufname('%')) ? ":w " . fnamemodify(getcwd(), ':p'): ":w\" 14 | noremap vem_save_all- :wall 15 | 16 | " Switch buffer 17 | noremap vem_switch_buffer- :CtrlPBuffer 18 | 19 | " Next/Prev buffer 20 | map vem_goto_next_buffer- vem#buffers#goto_next_buffer() 21 | map vem_goto_prev_buffer- vem#buffers#goto_prev_buffer() 22 | 23 | " Move buffer left 24 | map vem_shift_buffer_left- vem_move_buffer_left- 25 | 26 | " Move buffer right 27 | map vem_shift_buffer_right- vem_move_buffer_right- 28 | 29 | " Alternate buffer 30 | noremap vem_alternate_buffer- :b# 31 | 32 | " Smart close 33 | noremap vem_smart_close- :call vem#buffers#smart_close() 34 | 35 | " Close but keep window 36 | noremap vem_close_keep_window- :Sayonara! 37 | 38 | " Exit 39 | noremap vem_exit- :confirm qall 40 | 41 | -------------------------------------------------------------------------------- /src/mappings/comments.vim: -------------------------------------------------------------------------------- 1 | " Vem: comments 2 | 3 | " Toggle comment 4 | map vem_toggle_comment- NERDCommenterToggle 5 | 6 | " Block comment 7 | map vem_block_comment- NERDCommenterMinimal 8 | 9 | -------------------------------------------------------------------------------- /src/mappings/delete.vim: -------------------------------------------------------------------------------- 1 | " Vem: delete and change 2 | 3 | " Delete 4 | noremap vem_delete- x 5 | nnoremap vem_backspace- X 6 | vnoremap vem_backspace- x 7 | 8 | " Delete line 9 | noremap vem_delete_line- dd 10 | noremap vem_delete_inner_line- ^vg_c 11 | 12 | " Delete to the ends of the line 13 | nnoremap vem_delete_eol- d$ 14 | nnoremap vem_delete_bol- d^ 15 | 16 | " Delete current word and go into insert mode 17 | nnoremap vem_change_word- ciw 18 | 19 | " Delete selection and go into insert mode 20 | nnoremap vem_change- cc 21 | vnoremap vem_change- c 22 | 23 | " Delete to the ends of the line and go into insert mode 24 | nnoremap vem_change_eol- C 25 | nnoremap vem_change_bol- d^i 26 | 27 | " Delete between surroundings 28 | nmap vem_change_surrounded_text- (wildfire-fuel)vem_change- 29 | 30 | " Delete camel case 31 | noremap vem_vim_c- c 32 | nmap vem_camelcase_change- vem_vim_c-CamelCaseMotion_ie 33 | -------------------------------------------------------------------------------- /src/mappings/format.vim: -------------------------------------------------------------------------------- 1 | " Vem: format 2 | 3 | " Add line above/below 4 | noremap vem_add_line_above- :set pastemxO`x:set nopaste 5 | noremap vem_add_line_below- :set pastemxo`x:set nopaste 6 | 7 | " Add space left/right 8 | nnoremap vem_add_space_left- il 9 | vnoremap vem_add_space_left- il 10 | nnoremap vem_add_space_right- ah 11 | vnoremap vem_add_space_right- ah 12 | 13 | " Join lines 14 | noremap vem_join_lines- J 15 | 16 | " Indent/Unindent 17 | nnoremap vem_unindent- << 18 | vnoremap vem_unindent- <<gv 19 | 20 | nnoremap vem_indent- >> 21 | vnoremap vem_indent- >>gv 22 | 23 | " Enter 24 | nnoremap vem_enter- i^ 25 | 26 | " Format lines 27 | nnoremap vem_format_text- gqq 28 | vnoremap vem_format_text- gq 29 | 30 | " Format code 31 | nnoremap vem_format_code- gg=G 32 | vnoremap vem_format_code- = 33 | 34 | " Toggle case 35 | noremap vem_toggle_case- ~ 36 | 37 | " Force uppercase 38 | nnoremap vem_uppercase- gUll 39 | vnoremap vem_uppercase- U 40 | 41 | " Force lowercase 42 | nnoremap vem_lowercase- gull 43 | vnoremap vem_lowercase- u 44 | 45 | -------------------------------------------------------------------------------- /src/mappings/insert.vim: -------------------------------------------------------------------------------- 1 | " Vem: insert and command line mode 2 | 3 | " Up/Down 4 | inoremap vem_up- gk 5 | inoremap vem_down- gj 6 | cnoremap vem_up- 7 | cnoremap vem_down- 8 | 9 | " Left/Right 10 | noremap! vem_left- 11 | noremap! vem_right- 12 | 13 | " Clone character above/below cursor 14 | inoremap vem_clone_char_above- 15 | inoremap vem_clone_char_below- 16 | 17 | " execute a single command in normal mode 18 | inoremap vem_exec_normal_command- 19 | 20 | " insert special chars 21 | noremap! vem_insert_digraph- 22 | noremap! vem_insert_tab- 23 | 24 | " Space 25 | noremap! vem_space- 26 | 27 | " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, 28 | " so that you can undo CTRL-U after inserting a line break. 29 | inoremap vem_delete_to_eol- u 30 | 31 | " Vim compatibility 32 | cnoremap vem_insert_matching_names- 33 | 34 | " Autocomplete 35 | noremap! vem_autocomplete_prev- 36 | noremap! vem_autocomplete_next- 37 | noremap! vem_cancel_completion- 38 | inoremap vem_smarttab_next- vem#insert#smarttab('next') 39 | inoremap vem_smarttab_prev- vem#insert#smarttab('prev') 40 | 41 | -------------------------------------------------------------------------------- /src/mappings/macros.vim: -------------------------------------------------------------------------------- 1 | " Vem: macros 2 | 3 | " Macro recording 4 | noremap vem_record_macro_s- qs 5 | noremap vem_record_macro_x- qx 6 | noremap vem_append_macro_s- qS 7 | noremap vem_append_macro_x- qX 8 | 9 | " Macro play 10 | noremap vem_play_macro_s- @S 11 | noremap vem_play_macro_x- @X 12 | 13 | " Macro stop 14 | noremap vem_stop_recording- q 15 | 16 | -------------------------------------------------------------------------------- /src/mappings/marks.vim: -------------------------------------------------------------------------------- 1 | " Vem: marks 2 | 3 | " Set mark 4 | noremap vem_set_mark- m 5 | 6 | " Go to mark 7 | noremap vem_goto_mark- ` 8 | noremap vem_goto_mark_line- ' 9 | 10 | " Go to prev/next mark 11 | noremap vem_prev_mark- [` 12 | noremap vem_next_mark- ]` 13 | 14 | " Quick mark 15 | noremap vem_set_quick_mark- mQ 16 | noremap vem_goto_quick_mark- `Q 17 | -------------------------------------------------------------------------------- /src/mappings/misc.vim: -------------------------------------------------------------------------------- 1 | " Vem: miscelanea 2 | 3 | " Cancel command 4 | noremap vem_nop- 5 | 6 | " Repeat 7 | noremap vem_repeat- . 8 | 9 | " Redraw screen and clear last search highlighting 10 | nnoremap vem_redraw- :nohlsearch=has('diff')?'diffupdate':'' 11 | 12 | " Vim escape 13 | noremap vem_g_prefix- g 14 | noremap vem_z_prefix- z 15 | noremap vem_ctrlx_prefix- 16 | 17 | " Add/Substract one unit to the value under cursor 18 | noremap vem_add- 19 | noremap vem_sub- 20 | 21 | " Tags 22 | noremap vem_go_back- 23 | noremap vem_follow_tag- g 24 | 25 | " History 26 | map vem_jump_history_back- EnhancedJumpsLocalOlder 27 | map vem_jump_history_forward- EnhancedJumpsLocalNewer 28 | 29 | -------------------------------------------------------------------------------- /src/mappings/modes.vim: -------------------------------------------------------------------------------- 1 | " Vem: modes 2 | 3 | " Go to normal mode 4 | noremap vem_normal_mode- 5 | noremap! vem_normal_mode- 6 | 7 | " Replace mode 8 | noremap vem_replace_mode- R 9 | 10 | " Exit command line 11 | cnoremap vem_exit_command_line- 12 | 13 | " Go to insert mode (to the left of current character) 14 | nnoremap vem_insert_left- i 15 | 16 | " Go to insert mode (to the right of current character) 17 | nnoremap vem_insert_right- a 18 | 19 | " Open a new line above the current one and change to insert mode 20 | nnoremap vem_insert_above- O 21 | 22 | " Open a new line below the current one and change to insert mode 23 | nnoremap vem_insert_below- o 24 | 25 | " Go to beginning of line and change to insert mode 26 | noremap vem_insert_start- I 27 | 28 | " Go to end of line and change to insert mode 29 | noremap vem_insert_end- A 30 | 31 | -------------------------------------------------------------------------------- /src/mappings/quickfix.vim: -------------------------------------------------------------------------------- 1 | " Vem: quickfix 2 | 3 | " Browse quickfix results 4 | noremap vem_quickfix_prev_result- :cprev 5 | noremap vem_quickfix_next_result- :cnext 6 | 7 | " Browse location window results 8 | noremap vem_location_prev_result- :lprev 9 | noremap vem_location_next_result- :lnext 10 | 11 | -------------------------------------------------------------------------------- /src/mappings/replace.vim: -------------------------------------------------------------------------------- 1 | " Vem: replace 2 | 3 | " Replace character 4 | noremap vem_replace_char- r 5 | 6 | " Replace mode 7 | noremap vem_replace_mode- R 8 | 9 | " Execute last :s command again 10 | noremap vem_replace_again- & 11 | 12 | -------------------------------------------------------------------------------- /src/mappings/scroll.vim: -------------------------------------------------------------------------------- 1 | " Vem: window scroll 2 | 3 | noremap vem_scroll_up- 4 | noremap vem_scroll_down- 5 | noremap vem_scroll_to_top- zt 6 | noremap vem_scroll_to_middle- zz 7 | noremap vem_scroll_to_bottom- z- 8 | 9 | -------------------------------------------------------------------------------- /src/mappings/search.vim: -------------------------------------------------------------------------------- 1 | " Vem: search 2 | 3 | " Search 4 | noremap vem_search_forward- / 5 | noremap vem_search_backward- ? 6 | 7 | " Next/Previous result 8 | noremap vem_search_prev- N 9 | noremap vem_search_next- n 10 | 11 | " Search term under cursor 12 | noremap vem_search_word_under_cursor- * 13 | noremap vem_search_word_under_cursor_backwards- # 14 | 15 | " Search character in line 16 | noremap vem_search_char_forward- f 17 | noremap vem_search_char_backward- F 18 | noremap vem_repeat_search_char- ; 19 | 20 | -------------------------------------------------------------------------------- /src/mappings/select.vim: -------------------------------------------------------------------------------- 1 | " Vem: selections 2 | 3 | " Start visual mode 4 | nnoremap vem_start_char_selection- v 5 | nnoremap vem_start_block_selection- 6 | nnoremap vem_start_line_selection- V 7 | 8 | " Select between surroundings 9 | map vem_increase_selection- (wildfire-fuel) 10 | map vem_decrease_selection- (wildfire-water) 11 | 12 | " Move cursor to the ends of selection 13 | vnoremap vem_toggle_selection_end- o 14 | 15 | " Change selection mode 16 | vnoremap vem_change_selection_mode- vem#select#change_selection_mode() 17 | 18 | " Increase word selection 19 | vnoremap vem_increase_word_selection_left- :call vem#select#increase_word_selection('left', 0) 20 | vnoremap vem_increase_word_selection_right- :call vem#select#increase_word_selection('right', 0) 21 | vnoremap vem_increase_camelcase_selection_left- :call vem#select#increase_word_selection('left', 1) 22 | vnoremap vem_increase_camelcase_selection_right- :call vem#select#increase_word_selection('right', 1) 23 | 24 | " Reselect last selection 25 | nnoremap vem_reselect- gv 26 | 27 | " Deselect 28 | vnoremap vem_deselect- 29 | 30 | " Select last pasted or inserted text 31 | noremap vem_select_last_pasted_text- "`[" . strpart(getregtype(), 0, 1) . "`]" 32 | 33 | " Select camel case 34 | noremap vem_vim_v- v 35 | map vem_camelcase_select- vem_vim_v-CamelCaseMotion_ie 36 | -------------------------------------------------------------------------------- /src/mappings/spelling.vim: -------------------------------------------------------------------------------- 1 | " Vem: spelling 2 | 3 | " Next spelling mistake 4 | noremap vem_next_spell- ]s 5 | 6 | " Previous spelling mistake 7 | noremap vem_prev_spell- [s 8 | 9 | " Show suggestions 10 | noremap vem_suggest_spell- z= 11 | 12 | " Add word to dictionary (spellfile) 13 | noremap vem_add_spell- zg 14 | 15 | " Remove word from dictionary (spellfile) 16 | noremap vem_remove_spell- zug 17 | 18 | -------------------------------------------------------------------------------- /src/mappings/surround.vim: -------------------------------------------------------------------------------- 1 | " Vem: surround 2 | 3 | " surround visual selection 4 | vmap vem_add_surround- VSurround 5 | 6 | " delete surrounding markers 7 | nmap vem_delete_surround- Dsurround 8 | 9 | " change surrounding markers 10 | nmap vem_change_surround- Csurround 11 | 12 | -------------------------------------------------------------------------------- /src/mappings/tabpages.vim: -------------------------------------------------------------------------------- 1 | " Vem: tabpages 2 | 3 | " New tab 4 | noremap vem_new_tab- :tab split 5 | 6 | " New buffer in new tab 7 | noremap vem_new_tab_and_buffer- :tabnew 8 | 9 | " Previous tab 10 | noremap vem_prev_tab- :tabp 11 | 12 | " Next tab 13 | noremap vem_next_tab- :tabn 14 | 15 | " Go to tab 16 | noremap vem_goto_tab_1- :1tabnext 17 | noremap vem_goto_tab_2- :2tabnext 18 | noremap vem_goto_tab_3- :3tabnext 19 | noremap vem_goto_tab_4- :4tabnext 20 | noremap vem_goto_tab_5- :5tabnext 21 | noremap vem_goto_tab_6- :6tabnext 22 | noremap vem_goto_tab_7- :7tabnext 23 | noremap vem_goto_tab_8- :8tabnext 24 | noremap vem_goto_tab_9- :9tabnext 25 | 26 | -------------------------------------------------------------------------------- /src/mappings/undo.vim: -------------------------------------------------------------------------------- 1 | " Vem: undo 2 | 3 | " Undo 4 | nnoremap vem_undo- u 5 | vnoremap vem_undo- u 6 | 7 | " Undo line 8 | nnoremap vem_undo_line- U 9 | vnoremap vem_undo_line- U 10 | 11 | " Redo 12 | nnoremap vem_redo- 13 | vnoremap vem_redo- 14 | 15 | " Undo all changes (changes in the last 24 hours) 16 | noremap vem_undo_all- :earlier 24h 17 | 18 | " Redo all changes (more than 24h ahead) 19 | noremap vem_redo_all- :later 25h 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/mappings/windows.vim: -------------------------------------------------------------------------------- 1 | " Vem: windows 2 | 3 | " Move cursor to different window 4 | noremap vem_win_up- k 5 | noremap vem_win_down- j 6 | noremap vem_win_left- h 7 | noremap vem_win_right- l 8 | 9 | noremap vem_last_accessed_window- p 10 | 11 | " New window 12 | noremap vem_new_win_up- :aboveleft new 13 | noremap vem_new_win_left- :aboveleft vnew 14 | noremap vem_new_win_down- :belowright new 15 | noremap vem_new_win_right- :belowright vnew 16 | 17 | " Clone window 18 | noremap vem_clone_win_up- :aboveleft split 19 | noremap vem_clone_win_left- :aboveleft vsplit 20 | noremap vem_clone_win_down- :belowright split 21 | noremap vem_clone_win_right- :belowright vsplit 22 | 23 | " Move window 24 | noremap vem_move_win_top- K 25 | noremap vem_move_win_bottom- J 26 | noremap vem_move_win_left- H 27 | noremap vem_move_win_right- L 28 | 29 | " Rotate windows 30 | nnoremap vem_rotate_window_up- r 31 | nnoremap vem_rotate_window_down- R 32 | 33 | " Change size 34 | nnoremap vem_increase_win_height- :exe "resize " . (winheight(0) * 3/2) 35 | nnoremap vem_decrease_win_height- :exe "resize " . (winheight(0) * 2/3) 36 | nnoremap vem_increase_win_width- :exe "vertical resize " . (winwidth(0) * 3/2) 37 | nnoremap vem_decrease_win_width- :exe "vertical resize " . (winwidth(0) * 2/3) 38 | 39 | 40 | " Set the current window like the only one in current tabpage 41 | noremap vem_only_window- o 42 | 43 | " Close window 44 | noremap vem_close_window- c 45 | 46 | -------------------------------------------------------------------------------- /src/plugin-conf/enhancedjumps.vim: -------------------------------------------------------------------------------- 1 | " enhancedjumps.vim customization 2 | 3 | " Avoid EnhancedJumps plugin to override Vem keymaps 4 | nmap vem_discard_ej_older- EnhancedJumpsOlder 5 | nmap vem_discard_ej_newer- EnhancedJumpsNewer 6 | nmap vem_discard_ej_local_older- EnhancedJumpsLocalOlder 7 | nmap vem_discard_ej_local_newer- EnhancedJumpsLocalNewer 8 | nmap vem_discard_ej_remote_older- EnhancedJumpsRemoteOlder 9 | nmap vem_discard_ej_remote_newer- EnhancedJumpsRemoteNewer 10 | nmap vem_discard_ej_switch_remote_older- EnhancedJumpsSwitchRemoteOlder 11 | nmap vem_discard_ej_switch_remote_newer- EnhancedJumpsSwitchRemoteNewer 12 | nmap vem_discard_ej_far_fallback_older- EnhancedJumpsFarFallbackChangeOlder 13 | nmap vem_discard_ej_far_fallback_newer- EnhancedJumpsFarFallbackChangeNewer 14 | 15 | -------------------------------------------------------------------------------- /src/plugin-conf/nerdcommenter.vim: -------------------------------------------------------------------------------- 1 | " nerdcommenter customization 2 | 3 | " Don't create mappings 4 | let NERDCreateDefaultMappings = 0 5 | 6 | " Align comment delimiters to the left 7 | let NERDDefaultAlign = 'left' 8 | 9 | " Chell all lines to know which action to perform by toggling 10 | let NERDToggleCheckAllLines = 0 11 | 12 | " Don't use comment delimiters on empty lines 13 | let NERDCommentEmptyLines = 0 14 | 15 | " Comment whole lines independently of where the visual selection is 16 | let NERDCommentWholeLinesInVMode = 1 17 | 18 | " don't use menu 19 | let NERDMenuMode = 0 20 | 21 | " allow commenting already commented lines (nested comments) 22 | let NERDDefaultNesting = 1 23 | 24 | " use placeholders to delimit nested comments 25 | let NERDUsePlaceHolders = 1 26 | 27 | " add one space between the comment delimiter and the text 28 | let NERDSpaceDelims = 1 29 | 30 | " remove trailing whitespace when uncommenting 31 | let NERDTrimTrailingWhitespace = 1 32 | 33 | " this configuration makes nerdcommenter add two spaces after 34 | " delimiters in Python code. This fixes it. 35 | let g:NERDCustomDelimiters = { 36 | \ 'python': { 'left': '#', 'leftAlt': '#' }, 37 | \ } 38 | 39 | -------------------------------------------------------------------------------- /src/plugin-conf/netrw.vim: -------------------------------------------------------------------------------- 1 | " netrw customization 2 | 3 | " Don't load netrwPlugin 4 | let g:loaded_netrwPlugin = 1 5 | 6 | """ Configuration in case the plugin gets manually activated 7 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 8 | 9 | " NetrwPlugin has introduced an incompatible 'g' keybinding with vem 10 | " the following line deactivates it: 11 | let g:netrw_nogx = 1 12 | let g:netrw_home = g:vem_cache_dir 13 | 14 | -------------------------------------------------------------------------------- /src/plugin-conf/vim-surround.vim: -------------------------------------------------------------------------------- 1 | " vim-surround customization 2 | 3 | let g:surround_no_mappings = 1 4 | 5 | -------------------------------------------------------------------------------- /src/plugin-conf/wildfire.vim: -------------------------------------------------------------------------------- 1 | " wildfire.vim configuration 2 | 3 | " add all text objects 4 | let g:wildfire_objects = [ 5 | \ "i'", "a'", 6 | \ 'i"', "a\"", 7 | \ "i)", "a)", 8 | \ "i]", "a]", 9 | \ "i}", "a}", 10 | \ "i>", "a>", 11 | \ "it", "at" 12 | \] 13 | 14 | -------------------------------------------------------------------------------- /src/runtime.vim: -------------------------------------------------------------------------------- 1 | " Vem: set runtime directories 2 | 3 | " add Vem directory to runtime 4 | " (this is the first step so vim-pathogen is available for the next steps) 5 | let &runtimepath = &runtimepath . ',' . g:vem_dir . 'runtime/' 6 | 7 | " remove directories from a string with a comma separated list of them 8 | function! s:removeFromPath(path, pattern) 9 | let current_path = pathogen#split(a:path) 10 | let new_path = [] 11 | for directory in current_path 12 | if directory !~# a:pattern 13 | let new_path += [directory] 14 | endif 15 | endfor 16 | return pathogen#join(new_path) 17 | endfunction 18 | 19 | " remove Vim/Neovim user directories from the runtime and package paths 20 | if empty($HOME) 21 | let s:dirs_to_remove = '^\~.\+\(vim\|nvim\)' 22 | else 23 | let s:dirs_to_remove = '^\(' . escape($HOME, '\/') . '\/\|\~\).\+\(vim\|nvim\)' 24 | endif 25 | let &runtimepath = removeFromPath(&runtimepath, s:dirs_to_remove) 26 | if has('packages') 27 | let &packpath = removeFromPath(&packpath, s:dirs_to_remove) 28 | endif 29 | 30 | " set internal Vem plugin directory 31 | let s:vem_plugin_dir = g:vem_dir . 'plugins/' 32 | 33 | " set plugin directories (with support for Vim 8 packages structure for Vim 7 too) 34 | exec pathogen#infect(s:vem_plugin_dir . '{}', g:vem_user_dir . 'pack/{}/start/{}') 35 | 36 | " user configuration directory 37 | let &runtimepath = g:vem_user_dir . ',' . &runtimepath . ',' . g:vem_user_dir . 'after/' 38 | if has('packages') 39 | let &packpath = g:vem_user_dir . ',' . &packpath 40 | endif 41 | 42 | -------------------------------------------------------------------------------- /src/settings-gui.vim: -------------------------------------------------------------------------------- 1 | " Vem: default settings for the graphical interface 2 | 3 | if has('gui_running') 4 | 5 | " don't load menus 6 | let did_install_default_menus = 1 7 | let did_install_syntax_menu = 1 8 | set guioptions+=M 9 | 10 | " drop toolbar 11 | set guioptions-=T 12 | 13 | " drop menu bar 14 | set guioptions-=m 15 | 16 | " don't include tearoff options in menus 17 | set guioptions-=t 18 | 19 | " drop scrollbars 20 | set guioptions-=l 21 | set guioptions-=L 22 | set guioptions-=R 23 | 24 | " but add vertical scrollbar 25 | set guioptions+=r 26 | 27 | " don't enable keys to access menus 28 | set winaltkeys=no 29 | 30 | " disable autoselections 31 | set guioptions-=a 32 | set guioptions-=A 33 | set guioptions-=P 34 | 35 | " don't show dialog windows but use the statusline 36 | set guioptions+=c 37 | 38 | endif 39 | 40 | -------------------------------------------------------------------------------- /src/user-dirs.vim: -------------------------------------------------------------------------------- 1 | " Vem: user directories 2 | 3 | function! s:createDir(name) 4 | try 5 | call mkdir(a:name, "p") 6 | catch /^Vim\%((\a\+)\)\=:E739/ 7 | endtry 8 | endfunction 9 | 10 | """ user configuration directory 11 | """""""""""""""""""""""""""""""" 12 | 13 | if empty($XDG_CONFIG_HOME) 14 | let g:vem_user_dir = $HOME . '/.config/vem/' 15 | else 16 | let g:vem_user_dir = $XDG_CONFIG_HOME . '/vem/' 17 | endif 18 | call createDir(g:vem_user_dir) 19 | call createDir(g:vem_user_dir . 'colors/') 20 | call createDir(g:vem_user_dir . 'spell/') 21 | call createDir(g:vem_user_dir . 'pack/') 22 | 23 | """ user cache directory 24 | """""""""""""""""""""""" 25 | 26 | if empty($XDG_CACHE_HOME) 27 | let g:vem_cache_dir = $HOME . '/.cache/vem/' 28 | else 29 | let g:vem_cache_dir = $XDG_CACHE_HOME . '/vem/' 30 | endif 31 | call createDir(g:vem_cache_dir) 32 | call createDir(g:vem_cache_dir . 'swap/') 33 | call createDir(g:vem_cache_dir . 'undo/') 34 | call createDir(g:vem_cache_dir . 'backup/') 35 | call createDir(g:vem_cache_dir . 'views/') 36 | 37 | -------------------------------------------------------------------------------- /tests/edit-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $# -ne 1 ]]; then 4 | echo "Usage: $0 " 5 | exit 2 6 | fi 7 | 8 | TESTNAME=$1 9 | TESTDIR=$(dirname "$(readlink -f "$0")") 10 | INPUT="$TESTDIR/input/$TESTNAME" 11 | EXPECTED="$TESTDIR/expected/$TESTNAME" 12 | SCRIPT="$TESTDIR/script/$TESTNAME" 13 | 14 | # create input file 15 | vem $INPUT 16 | 17 | # create expected and script files by modifying the input 18 | cp $INPUT $EXPECTED 19 | vem -W $SCRIPT $EXPECTED 20 | 21 | -------------------------------------------------------------------------------- /tests/expected/W.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | one 3 | bbbbb 4 | -------------------------------------------------------------------------------- /tests/expected/a-z.txt: -------------------------------------------------------------------------------- 1 | aaa 2 | 3 | bbbbb 4 | 5 | CCCcc 6 | -------------------------------------------------------------------------------- /tests/expected/i-o.txt: -------------------------------------------------------------------------------- 1 | ============== 2 | 3 | *foo* *bar* 4 | 5 | ============== 6 | -------------------------------------------------------------------------------- /tests/expected/w-sw.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | one 3 | bbbbb 4 | -------------------------------------------------------------------------------- /tests/expected/y-n.txt: -------------------------------------------------------------------------------- 1 | 2 | ================================= 3 | 4 | --------------------------------- 5 | 6 | ================================= 7 | 8 | -------------------------------------------------------------------------------- /tests/input/W.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | bbbbb 3 | -------------------------------------------------------------------------------- /tests/input/a-z.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | 3 | bbbbb 4 | 5 | ccccc 6 | -------------------------------------------------------------------------------- /tests/input/i-o.txt: -------------------------------------------------------------------------------- 1 | ============== 2 | 3 | ** ** 4 | 5 | ============== 6 | -------------------------------------------------------------------------------- /tests/input/w-sw.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | bbbbb 3 | -------------------------------------------------------------------------------- /tests/input/y-n.txt: -------------------------------------------------------------------------------- 1 | ================================= 2 | --------------------------------- 3 | ================================= 4 | -------------------------------------------------------------------------------- /tests/output/W.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | one 3 | bbbbb 4 | -------------------------------------------------------------------------------- /tests/output/a-z.txt: -------------------------------------------------------------------------------- 1 | aaa 2 | 3 | bbbbb 4 | 5 | CCCcc 6 | -------------------------------------------------------------------------------- /tests/output/i-o.txt: -------------------------------------------------------------------------------- 1 | ============== 2 | 3 | *foo* *bar* 4 | 5 | ============== 6 | -------------------------------------------------------------------------------- /tests/output/w-sw.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | one 3 | bbbbb 4 | -------------------------------------------------------------------------------- /tests/output/y-n.txt: -------------------------------------------------------------------------------- 1 | 2 | ================================= 3 | 4 | --------------------------------- 5 | 6 | ================================= 7 | 8 | -------------------------------------------------------------------------------- /tests/run-tests: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $# -gt 2 ]]; then 4 | echo "Usage: $0 [] []" 5 | exit 2 6 | fi 7 | 8 | COMMAND=$1 9 | TESTNAME=$2 10 | TESTDIR=$(dirname "$(readlink -f "$0")") 11 | SCRIPTS=$(ls $TESTDIR/script/${TESTNAME:-*}) 12 | if [ -z "$COMMAND" ]; then 13 | declare -a EXECUTABLES=("vem -X" "gvem -f") 14 | else 15 | declare -a EXECUTABLES=("$COMMAND") 16 | fi 17 | 18 | for EXECUTABLE in "${EXECUTABLES[@]}"; 19 | do 20 | echo "=== Running tests for $EXECUTABLE ===" 21 | for FILE in $SCRIPTS; 22 | do 23 | 24 | TESTNAME=$(basename $FILE) 25 | echo "$TESTNAME" 26 | 27 | INPUT="$TESTDIR/input/$TESTNAME" 28 | SCRIPT="$TESTDIR/script/$TESTNAME" 29 | OUTPUT="$TESTDIR/output/$TESTNAME" 30 | EXPECTED="$TESTDIR/expected/$TESTNAME" 31 | 32 | # clean previous run 33 | cp $INPUT $OUTPUT 34 | 35 | # apply script over output file 36 | $EXECUTABLE -s $SCRIPT $OUTPUT 37 | 38 | # compare result 39 | diff $OUTPUT $EXPECTED 40 | if [ $? -ne 0 ]; then 41 | echo "Error" 42 | else 43 | echo "Ok" 44 | fi 45 | done 46 | done 47 | 48 | -------------------------------------------------------------------------------- /tests/samples/one.txt: -------------------------------------------------------------------------------- 1 | one 2 | -------------------------------------------------------------------------------- /tests/samples/two.txt: -------------------------------------------------------------------------------- 1 | two 2 | -------------------------------------------------------------------------------- /tests/script/W.txt: -------------------------------------------------------------------------------- 1 | Wh-samples l-one leTpsxx -------------------------------------------------------------------------------- /tests/script/a-z.txt: -------------------------------------------------------------------------------- 1 | zaOOsx -------------------------------------------------------------------------------- /tests/script/i-o.txt: -------------------------------------------------------------------------------- 1 | jjlllllifoolllllhobarsx -------------------------------------------------------------------------------- /tests/script/w-sw.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pacha/vem/c48e73576ccca043b2f612f7fde2b68abd635f10/tests/script/w-sw.txt -------------------------------------------------------------------------------- /tests/script/y-n.txt: -------------------------------------------------------------------------------- 1 | jynjjnkkkkysx -------------------------------------------------------------------------------- /tests/view-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $# -ne 1 ]]; then 4 | echo "Usage: $0 " 5 | exit 2 6 | fi 7 | 8 | TESTNAME=$1 9 | TESTDIR=$(dirname "$(readlink -f "$0")") 10 | INPUT="$TESTDIR/input/$TESTNAME" 11 | SCRIPT="$TESTDIR/script/$TESTNAME" 12 | EXPECTED="$TESTDIR/expected/$TESTNAME" 13 | OUTPUT="$TESTDIR/output/$TESTNAME" 14 | 15 | echo "=== input ===" 16 | cat $INPUT 17 | echo "=== script ===" 18 | hexdump -c $SCRIPT 19 | echo "=== expected ===" 20 | cat $EXPECTED 21 | echo "=== output ===" 22 | cat $OUTPUT 23 | echo "=== diff ===" 24 | diff $EXPECTED $OUTPUT 25 | 26 | --------------------------------------------------------------------------------