New features:
- |post_finish| snippet action: runs once when the snippet leaves the active stack, whether through tabbing past the final tabstop, the cursor moving outside the snippet, or the buffer being left. Pairs with |pre_expand| for state that must be cleaned up no matter how the user exits. See |UltiSnips-snippet-actions|. (#1672, #1415)
- New snippet option
x: finishes in normal mode when the user reaches$0by jumping forward, instead of dropping back into insert. See |UltiSnips-snippet-options|. (#1671, #1399) - New snippet option
p: matches if the typed word is any non-empty prefix of the trigger, so typingi,im, ...,importall expand. See |UltiSnips-snippet-options|. (#1670, #1207) - |:UltiSnipsRemoveFiletypes| / |UltiSnips#RemoveFiletypes()|: the inverse of |:UltiSnipsAddFiletypes|. Useful when
set filetype=html.cssactivates two snippet sets and you want to suppress one. See |UltiSnips-commands|. (#1669, #792) - |:UltiSnipsListLocations| and |UltiSnips#SnippetLocations()|: populate the quickfix list with every snippet's defining file and line so you can jump to definitions with standard quickfix bindings. See |UltiSnips-commands|. (#1668, #1198)
User UltiSnipsJumpedautocommand fires after every successful jump (initial tabstop and every subsequent jump), with the final$0deliberately excluded soUltiSnipsExitLastSnippetstays the right hook for snippet exit. See |UltiSnips-custom-autocommands|. (#1665, #1500)snip.visual_text,snip.visual_mode, andsnip.visual_contentare now available inpost_jumpactions, matching the existing context-code surface.snip.visual_contentis also kept correct on the snippet instance for the duration of the snippet, so consumers reading it later (e.g. throughsnip.context) no longer see the post-reset empty value. (#1673, #1524)- |g:current_ulti_dict_info| is now always populated by |UltiSnips#SnippetsInCurrentScope()|, not just when called with
1. Consumers reading the matching subset now also see each snippet's defining file and line. (#1667, #981)
Breaking changes:
- Insertion at or past the active snippet's end with no child tabstop claiming the edit (e.g. pressing
oafter the snippet) now terminates the snippet instead of extending its bounds onto the new line. The expand/jump triggers stop responding once the cursor has clearly left the snippet. (#1649, #1311) - The remote debug server for Python snippets introduced in 4.0 was removed, together with
g:UltiSnipsDebugServerEnable,g:UltiSnipsDebugHost,g:UltiSnipsDebugPort, andg:UltiSnipsPMDebugBlocking. (#1677)
Bug fixes:
- Unnamed register
@"no longer gets clobbered when a snippet is triggered from visual mode. (#1635, #1297) - Yank register
@0and registers@1-@9,@-are now preserved across snippet expansion. (#1636, #1037) - "Multiple matches" prompt no longer shows duplicate entries when the same file is reachable via a symlinked runtimepath entry or via an
<ft>_*.snippetsglob that anextendsdirective also references.extends foo.snippetsis now treated asextends foo. (#1637, #1341, #1519, #1559) - Stray move-command bytes (
<Esc>,v3G10|o3G4|o, ...) no longer leak into the buffer when apost_jumpaction calls a typeahead-consuming Vim function or nests asnip.expand_anonwhose first tabstop is defaulted. (#1638, #751) - Tabstops no longer drift out of sync after edits in multi-line snippets whose end sits at column 0, or after edits past column 0 on the first line of a snippet that starts at column 0. (#1641, #1182, #193)
- Transformation replacement strings no longer reinterpret a captured
\u/\l/\U/\L/\Eas a case-switch escape. (#1642, #1444) - Empty
${VISUAL}lines are now stripped when the snippet has themoption, so the renderer's indent of an empty visual line no longer survives. (#1647, #503) - Cursor attribution at zero-width tabstop seams (e.g.
$1$1$2) no longer prefers the later sibling, so mirrors stay routed to the source tabstop after the first character. (#1646, #1359) - Re-entering insert mode outside the snippet bounds (e.g.
<Esc>theno) terminates the snippet instead of leaving the jump triggers mapped against a stale span. (#1648, #1454) post_jumpactions that move the cursor or edit the buffer now compose with the select-mode placeholder selection: the move command is rebuilt from the tabstop's current bounds before being fed.snip.expand_anonfrom apost_expandaction no longer splices the inner body into the middle of the outer or skips the inner snippet's first tabstop. (#1652, #1013, #1434)snip.mklinenow keeps the snippet indent on every line when the python block builds its result in one expression ("\n".join(snip.mkline(x) for x in items)and similar). (#1655, #1233)- "Multiple matches" prompt now treats answers outside the valid range as a cancellation instead of clamping to the last item or raising
IndexError. (#1653, #1226) :UltiSnipsEditnow resolves symlinks when matching snippet directories against the vim config directory, so symlinkedUltiSnips/setups and macOS/var->/private/varredirections find a default directory again. (#1656, #1543)- Cursor visiting an auxiliary window (
:peditpreview, quickfix, neovim floats) no longer tears down the active snippet. (#1657, #1168) - The snippets syntax file now honours
\/as an escape inside${VISUAL:...}defaults, so${VISUAL:\/* code *\/}no longer bleeds into the next snippet's highlight group. (#1659, #1468) :UltiSnipsEdit!picker now includes SnipMate*.snippetsfiles wheng:UltiSnipsEnableSnipMateis on. (#1660, #1360)- Vim no longer spams a stack trace on every keystroke when
py3cannot load libpython or theUltiSnipspackage is not importable. The plugin opens a[UltiSnips Python diagnostics]scratch buffer with the failure reason and environment details to paste into a bug report (also exposed asg:UltiSnipsPythonDiagnostics, suppressible via |g:UltiSnipsNoPythonWarning|) and bails out cleanly. See |UltiSnips-python-warning|. (#1658, #1686, #1237, #1209, #1377) - Doc example for |UltiSnips#ExpandPossibleShorterSnippet| no longer leaves a trailing space in the buffer after expanding. (#1654, #951)
- UltiSnips-format snippet files placed in a snipMate-reserved
snippets/directory now emit an actionable error pointing to either renaming the directory toUltiSnips/or settingg:UltiSnipsEnableSnipMate = 0, instead of failing withInvalid line 'endsnippet'or silently not expanding. (#1675) - User-attributable snippet errors (
!pblock exceptions and pre/post-expand action exceptions) are now shown without the internal UltiSnips call stack. Genuine UltiSnips bugs still carry the full trace and the "please report" preamble. (#1676) - Neovim:
post_expandactions that rewrite the line the snippet ends on no longer raise a spurious "line under the cursor was modified" error. (#1682) - |g:UltiSnipsListSnippets| now offers
w-option snippets when the partially typed trigger follows a non-word character (e.g.x.folistsfoo). (#1684) - Vim 8.2 is no longer rejected at startup with "UltiSnips requires Vim >= 8.2"; the version check compared against 820 instead of 802. (#1687)
snip.expand_anonfrom apost_expandaction no longer drops the inner body when it has no tabstop (plain text or only$0). (#1689, #1688)- Hidden files in snippet directories (Vim undo and swap files,
.DS_Store, ...) are ignored again during snippet discovery instead of crashing with aUnicodeDecodeError. (#1693, #1691) - Work around a globbing performance issue in Python 3.12 (#1696, #1694)
- Register changes the user makes while a snippet is still active but no placeholder is being replaced are no longer reverted to the pre-snippet registers when insert mode is left or the snippet is torn down. (#1697, #1695)