Vim 9.2 is available The Vim project is happy to announce that Vim 9.2 has been released. Vim 9.2 brings significant enhancements to the Vim9 scripting language, improved diff mode, comprehensive completion features, and platform-specific improvements including experimental Wayland support. New Features in Vim 9.2 Comprehensive Completion: Added support for fuzzy matching during insert-mode completion and the ability to complete words directly from registers ( CTRL-X CTRL-R ). New 'completeopt' flags like nosort and nearest offer finer control over how matches are displayed and ordered.
Added support for during insert-mode completion and the ability to complete words directly from ( ). New flags like and offer finer control over how matches are displayed and ordered. Modern Platform Support: Full support for the Wayland UI and clipboard has been added. On Linux and Unix-like systems, Vim now adheres to the XDG Base Directory Specification , using $HOME/.config/vim for user configuration.
Full support for the UI and clipboard has been added. On Linux and Unix-like systems, Vim now adheres to the , using for user configuration. UI Enhancements: A new vertical tabpanel provides an alternative to the horizontal tabline. The MS-Windows GUI now supports native dark mode for the menu and title bars, along with improved fullscreen support and higher-quality toolbar icons.
A new provides an alternative to the horizontal tabline. The GUI now supports native dark mode for the menu and title bars, along with improved fullscreen support and higher-quality toolbar icons. Interactive Learning: A new built-in interactive tutor plugin (started via :Tutor ) provides a modernized learning experience beyond the traditional vimtutor. Vim9 Script Evolution Significant language enhancements including native support for Enums, Generic functions, and the Tuple data type. Built-in functions are now integrated as object methods, and classes now support protected _new() methods and :defcompile for full method compilation. Vim9 Script Ecosystem & AI Integration The maturity of Vim9 script's modern constructs is now being leveraged by advanced AI development tools. Contributor Yegappan Lakshmanan recently demonstrated the efficacy of these new features through two projects generated using GitHub Copilot: Battleship in Vim9: A complete implementation of the classic game, showcasing classes and type aliases. [GitHub]
A complete implementation of the classic game, showcasing classes and type aliases. [GitHub] Number Puzzle: A logic game demonstrating the efficiency of modern Vim9 for interactive plugins. [GitHub] Diff Improvements Vim 9.2 introduces significant enhancements to how changes are visualized and aligned in diff mode: Linematch Algorithm: Includes the "linematch" algorithm for the 'diffopt' setting. This aligns changes between buffers on similar lines, greatly improving diff highlighting accuracy.
Includes the "linematch" algorithm for the setting. This aligns changes between buffers on similar lines, greatly improving diff highlighting accuracy. Diff Anchors: The new 'diffanchors' option allows you to specify anchor points (comma-separated addresses) to split and independently diff buffer sections, ensuring better alignment in complex files.
The new option allows you to specify anchor points (comma-separated addresses) to split and independently diff buffer sections, ensuring better alignment in complex files. Inline Highlighting: Improves highlighting for changes within a line. This is configurable via the "inline" sub-option for 'diffopt' . Note that "inline:simple" has been added to the default 'diffopt' value. Here are some examples for the improved inline highlighting: inline:simple (old behavior) inline:char inline:word Changed Default Values Here are some examples for the improved inline highlighting: Several long-standing defaults have been updated to better suit modern hardware and workflows. These values have been removed from defaults.vim as they are now the internal defaults. Option Old Default New Default (9.2) 'history' 50 200 (More undo/command history saved) 'backspace' "" (empty) "indent,eol,start" (Normal backspace behavior) 'diffopt' "internal,filler" "internal,filler,closeoff,indent-heuristic,inline:char" 'fontsize' (GTK) 10pt 12pt (Optimized for High-DPI monitors) 'showcmd' Off (Unix) On (Always visible in non-compatible mode) 'ruler' Off On (Shows cursor position by default) Completion Feature Examples These examples demonstrate how to use the powerful new completion and introspection tools available in Vim 9.2. 1. Auto-completion Vim's standard completion frequently checks for user input while searching for new matches. It is responsive irrespective of file size. This makes it well-suited for smooth auto-completion. Copy Code vim9script def InsComplete() if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$' SkipTextChangedIEvent() feedkeys("\
") var altbuf = bufs->indexof((_, v) => v =~ '^\s*\d\+\s\+#') if altbuf != -1 [bufs[0], bufs[altbuf]] = [bufs[altbuf], bufs[0]] endif return arglead == '' ? bufs : bufs->matchfuzzy(arglead) enddef def SelectItem() selected_match = '' if getcmdline() =~ '^\s*\%(Grep\|Find\|Buffer\)\s' var info = cmdcomplete_info() if info != {} && info.pum_visible && !info.matches->empty() selected_match = info.selected != -1 ? info.matches[info.selected] : info.matches[0] setcmdline(info.cmdline_orig) # Preserve search pattern in history endif endif enddef command! -nargs=+ -complete=customlist,GrepComplete Grep VisitFile() command! -nargs=* -complete=customlist,FuzzyBuffer Buffer exe 'b ' .. selected_match->matchstr('\d\+') command! -nargs=* -complete=customlist,FuzzyFind Find exe !empty(selected_match) ? $'e {selected_match}' : '' nnoremap
... continue reading