tests-cases.md
Branches > main > a1efde1 > files / nvim / pack / plugins / opt / parinfer-rust / tests / vim / tests-cases.md
# Parinfer## Fixes parens on initial load```(foo [ x])``````(foo [ x])```## Smart mode pushes brackets```(foo [ x])```After `llib<Esc>`:```(fboo [ x])```## [Not Working] "force balance" mode can be enabledThis is currently not working due to an issue where the Rust port does notmatch the JavaScript implementation when "forceBalance" is set.```(foo [:baz])```After `:set lisp<CR>:let g:parinfer_force_balance=1<CR>f]i<Enter><Esc>`:```(foo [:baz])```## Is disabled when `&paste` is setVim's `&paste` option is for pasting into the terminal. Vim receives thetext as many keystrokes, essentially, so we should not be reformatting thecode as it is being added.```(foo)```After `:set paste<CR>i))<Esc>`:```))(foo)```## change commands fix indent```(foo [ x])````lcwa<Esc>` will produce:```(a [ x])```## >> reindents rest of form```(foo (bar baz quux))```After `j>>`:```(foo (bar baz quux))```## appending after (let [```(let [ x])```After `Ay<Esc>`:```(let [y x])```# Regressions## E523```(foo bar baz)```After `wwciw(hi<Esc>j.`:```(foo (hi) (hi))```## E121Splitting a window doesn't trigger BufEnter, because we don't switch buffers,so we need to copy window-local state to the new window.```(foo)```After `lli <Esc>:w<CR>:split<CR>lay<Esc>````(f oyo)```## Undefined variable `b:parinfer_last_changedtick` (#27, #28)```(foo)```After `:unlet b:parinfer_last_changetick b:parinfer_previous_text w:parinfer_previous_cursor<CR>ixx<Esc>`:```xx(foo)```## [Not Working] Deleting to end-of-line (#21)Normal-mode commands which delete to the end of the line move the cursor backone space to keep it within the line. This confuses parinfer when we don'taccomodate this.```(let [a "foo"])```After `f"D`:```(let [a ])```# Joining lines## `J` joins two lines correctly (#10)Joining lines with `J` should reindent the second line so as to not breaktheir meaning.```(foo (bar baz))```After `J`:```(foo (bar baz))```## `J` joins multiple lines correctly (#10)```(foo (bar [baz quux]))```After `3J`:```(foo (bar [baz quux]))```# Compatibility with vim-fireplace## Works in an input command-line window (#15)This test is very hackish.```(foo)```After `:call setline(1,input('=>'))<CR><C-F>i(x<CR>`:```(x)```# Undo (#14)## Regular Vim undoThis case shouldn't need to do anything fancy to mess with Vim's undohandling.```xy```After `2GO<Esc>O<Esc>u`:```xy```## Undo after triggering parinfer in insert modeThis triggers a parinfer update while in insert mode. In theory, we shouldn'tneed to call "undojoin" here because Vim groups all insert changes (and ourcall to |setline()|).```xy```After `2GO<Esc>O[<Esc>u`:```xy```## Undo after triggering parinfer (closing) in insert modeThis one is like the last, except that it will delete an extra closing brace,which will hopefully not mess with Vim.```xy```After `2GO<Esc>O[]<Esc>u`:```xy```## Undo with multiple parinfer changes in insert (#14)This requires Vim >= 8.1.0256.```(defn f [x] x)(defn g [y] y)```After `4GO<Enter>(defn h<Enter> [z]<Enter>z)<Esc>u`:```(defn f [x] x)(defn g [y] y)```# Unicode (#26)## hukka's example (#26)```(def aaa {:foo 1 :bar 1})```After `wwciwäää<Esc>:````(def äää {:foo 1 :bar 1})```## Smart mode after composed characters (#26)Vim's getpos('.') returns the column in byte count, so we need to usevirtcol('.') to give a good column number to parinfer-rust.```(def å [])```After `f]ix<Esc>`:```(def å [x])```## Cursor position with fullwidth text (#87)```;; 12345```After `6lixy<Esc>`:```;; 123xy45```