Repository navigation
fix(macos): make Vim mode's operators, motions, paste and marks match Vim - #4347
Merged
Merged
Conversation
… and tab switches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Vim mode now does what
vim -u NONEdoes for each of these. Found while porting the engine to Windows (#4338); the Windows engine gets the same fixes.df<Esc>w,dfzw,d;w,d/<Esc>w,dxwand"a<Esc>ywno longer delete or write a register. A count or register a command does not use is dropped (3maxdeletes one character).d%c%y%,dnd*,d}d),d]],dHdL,d'a(linewise),d`a,2d/patternEnter,d+d-. A motion that finds nothing ends the command.:help exclusive(dbat a line start keeps the line break,d}from the indent takes whole lines),dWstops at the line end asdwdoes,cwchanges to the word's end,cjandcipleave a line to type on,dFanddTare exclusive,>wshifts the whole line,djon the last line deletes nothing."a2ppastes register a twice; a countedPkeeps each copy whole. A linewise paste lands on the first non-blank,yypon a last line with no line break adds it, and a paste over several lines lands at its start.SQLEditorCoordinator,willReplaceContentsIn); an edit journal keeps the positions from before each edit, so an undo or redo that reverses edits (one at a time or folded, as an undo step can join them) puts them back, as Vim's undo restores its marks. A tab switch keeps all of it.viwthe next motion extends the selection;vipis Visual Line. Visual mode takes"x, andpkeeps the replaced text in the unnamed register whilePdoes not.aandpon an empty line stay on it.ipandaptake whole lines, soipon the last paragraph keeps its last character; a line of only blanks ends a paragraph, and on blank lines they take the blank lines.iwand*class a character by its first scalar (VimWordScanner, shared by the adapter and the test mock), sow,e,bstep over❤️.+and-go to the first non-blank of the next or previous line;{N}%,2H,2L,2*and2]]take their counts.windows/src/TablePro.Editor.Model/Vim): the same behaviors where the port still had them; 0017 updated.VimEngineTextObjectsTests.dIPDeletesInnerParagraph(linewisedip),VimEngineOperatorsTests.cWChangesWord(cwkeeps the space),VimTextBufferAdapterLineIndexTests.sectionForwardStaysLinear(]]with no section lands on the last line's start); on Windows the matchingDIPDeletesInnerParagraphandCWChangesWord, and two mark tests inVimCommandEdgeTests(a mark keeps its column when text is typed before it on its line).Test plan
apple/TableProTests/Core/Vim) for each item; each expectation was measured in Vim 9.1 withvim -u NONE.SQLEditorVimMarksTests: in a real editor with Vim on, a line typed above a mark moves it and undo moves it back.verify.sh teston every Vim suite and the editor coordinator suites;verify.sh linton each changed file.verify.sh --platform windows test TablePro.Editor.Model.Tests.