*version9.txt* For Vim version 9.1. Last change: 2024 Apr 14 VIM REFERENCE MANUAL by Bram Moolenaar *vim-9.0* *vim-9* *version-9.0* *version9.0* Welcome to Vim 9! Several years have passed since the previous release. A large number of bugs have been fixed, many nice features have been added and the Vim9 script syntax is here! This file mentions all the new things and changes to existing features since Vim 8.2.0. The patches up to Vim 8.2 can be found here: |vim-8.2|. Use this command to see the full version and features information of the Vim program you are using: > :version NEW FEATURES |new-9| Vim script enhancements |new-vim-script-9| Command line completion in a popup menu |new-popup-compl| Updated colorschemes |new-colorschemes-9| Various new items |new-items-9| INCOMPATIBLE CHANGES |incompatible-9| IMPROVEMENTS |improvements-9| COMPILE TIME CHANGES |compile-changes-9| PATCHES |patches-9| VERSION 9.1 |version-9.1| Changed |changed-9.1| Added |added-9.1| Patches |patches-9.1| See |vi_diff.txt| for an overview of differences between Vi and Vim 9.0. See |version4.txt|, |version5.txt|, |version6.txt|, |version7.txt| and |version8.txt| for differences between Vim versions. You can find an overview of the most important changes (according to Martin Tournoij) on this site: https://www.arp242.net/vimlog/ *Sven-Guckes* Vim version 9.0 is dedicated to Sven Guckes, who passed away in February 2022 when the release was being prepared. Sven was a long time supporter of Vim. He registered the vim.org domain and created the first Vim website. We will remember him! *Bram* *Moolenaar* *Bram-Moolenaar* Vim version 9.1 is dedicated to Bram Moolenaar, who passed away on August 3rd 2023 while still working full-time on Vim. The Vim project would not exist without his ongoing passion to lead and develop Vim and the community for more than 30 years. Bram was also passionate about his |ICCF| foundation to help children in Uganda. If you enjoy using Vim, please consider donating! We will miss his guidance, passion and leadership. Obituary Articles: https://github.com/vim/vim/discussions/12742 Say Farewell: https://github.com/vim/vim/discussions/12737 ============================================================================== NEW FEATURES *new-9* First an overview of the more interesting new features. A comprehensive list is below. Vim9 script ~ *new-vim-script-9* The Vim script language has been changed step by step over many years, preserving backwards compatibility. Several choices made in the early days got in the way of making it work better. At the same time, Vim script is being used much more often, since there are so many plugins being used. Vim9 script provides a syntax that is much more similar to other languages. In other words: "less weird". Compiled functions are introduced which allow for a large speed improvement. You can expect around ten times faster execution, or even more. The price to pay is that Vim9 script is not backwards compatible. But don't worry, you can still use your old scripts, the new script language is added, it does not replace the legacy script. Information about Vim9 script can be found in the |Vim9| help file. Command line completion in a popup menu ~ *new-popup-compl* Before there was the 'wildmenu' option, which uses the space of one line above the statusline to show matches. Only a few matches fit there. Now a popup menu can be used by setting 'wildoptions' to "pum". This allows for showing many more matches. This requires redrawing more of the display, but since computers are fast enough that is not a problem. Updated colorschemes ~ *new-colorschemes-9* Colorschemes from https://github.com/vim/colorschemes have been included. They were made to work consistently across many types of terminals. Although generally an improvement, a lot of personal preference is involved. You can always get the old version if you prefer it, look here: https://github.com/vim/colorschemes/blob/master/legacy_colors/ Various new items ~ *new-items-9* Options: ~ 'autoshelldir' change directory to the shell's current directory 'cdhome' change directory to the home directory by ":cd" 'cinscopedecls' words that are recognized by 'cino-g' 'guiligatures' GTK GUI: ASCII characters that can form shapes 'mousemoveevent' report mouse moves with 'quickfixtextfunc' function for the text in the quickfix window 'spelloptions' options for spell checking 'thesaurusfunc' function to be used for thesaurus completion 'xtermcodes' request terminal codes from an xterm Ex commands: ~ |:abstract| (reserved for future use) |:argdedupe| remove duplicates from the argument list |:balt| like ":badd" but also set the alternate file |:class| (reserved for future use) |:def| define a Vim9 user function |:defcompile| compile Vim9 user functions in current script |:disassemble| disassemble Vim9 user function |:echoconsole| like :echomsg but write to stdout |:endinterface| (reserved for future use) |:endclass| (reserved for future use) |:enddef| end of a user function started with :def |:endenum| (reserved for future use) |:enum| (reserved for future use) |:eval| evaluate an expression and discard the result |:export| Vim9: export an item from a script |:final| declare an immutable variable in Vim9 |:import| Vim9: import an item from another script |:interface| (reserved for future use) |:static| (reserved for future use) |:type| (reserved for future use) |:var| variable declaration in Vim9 |:vim9script| indicates Vim9 script file Ex command modifiers: ~ |:legacy| make following command use legacy script syntax |:vim9cmd| make following command use Vim9 script syntax New and extended functions: ~ |assert_nobeep()| assert that a command does not cause a beep |autocmd_add()| add a list of autocmds and groups |autocmd_delete()| delete a list of autocmds and groups |autocmd_get()| return a list of autocmds |blob2list()| get a list of numbers from a blob |charclass()| class of a character |charcol()| character number of the cursor or a mark |charidx()| character index of a byte in a string |digraph_get()| get digraph |digraph_getlist()| get all digraphs |digraph_set()| register digraph |digraph_setlist()| register multiple digraphs |echoraw()| output characters as-is |exists_compiled()| like exists() but check at compile time |extendnew()| make a new Dictionary and append items |flatten()| flatten a List |flattennew()| flatten a copy of a List |fullcommand()| get full command name |getcharpos()| get character position of cursor, mark, etc. |getcharstr()| get a character from the user as a string |getcmdcompltype()| return current cmdline completion type |getcmdscreenpos()| return the current cursor position in the cmdline |getcursorcharpos()| get character position of the cursor |getmarklist()| list of global/local marks |getreginfo()| get information about a register |gettext()| lookup message translation |hlget()| get highlight group attributes |hlset()| set highlight group attributes |isabsolutepath()| check if a path is absolute |list2blob()| get a blob from a list of numbers |maplist()| list of all mappings, a dict for each |mapnew()| make a new List with changed items |mapset()| restore a mapping |matchfuzzy()| fuzzy matches a string in a list of strings |matchfuzzypos()| fuzzy matches a string in a list of strings |menu_info()| get information about a menu item |popup_list()| get list of all popup window IDs |prompt_getprompt()| get the effective prompt text for a buffer |prop_add_list()| attach a property at multiple positions |prop_find()| search for a property |readblob()| read a file into a Blob |readdirex()| get a List of file information in a directory |reduce()| reduce a List to a value |searchcount()| get number of matches before/after the cursor |setcellwidths()| set character cell width overrides |setcharpos()| set character position of cursor, mark, etc. |setcursorcharpos()| set character position of the cursor |slice()| take a slice of a List |strcharlen()| length of a string in characters |terminalprops()| properties of the terminal |test_gui_event()| generate a GUI event for testing |test_null_function()| return a null Funcref |test_srand_seed()| set the seed value for srand() |test_unknown()| return a value with unknown type |test_void()| return a value with void type |typename()| type of a variable as text |virtcol2col()| byte index of a character on screen |win_gettype()| get type of window |win_move_separator()| move window vertical separator |win_move_statusline()| move window status line |windowsversion()| get MS-Windows version New Vim variables: ~ |v:numbermax| maximum value of a number |v:numbermin| minimum value of a number (negative) |v:numbersize| number of bits in a Number |v:collate| current locale setting for collation order |v:exiting| vim exit code |v:colornames| dictionary that maps color names to hex color strings |v:sizeofint| number of bytes in an int |v:sizeoflong| number of bytes in a long |v:sizeofpointer| number of bytes in a pointer |v:maxcol| maximum line length New autocommand events: ~ |CompleteDonePre| after Insert mode completion done, before clearing info |DirChangedPre| before the working directory will change |InsertLeavePre| just before leaving Insert mode |ModeChanged| after changing the mode |SigUSR1| after the SIGUSR1 signal has been detected |WinClosed| after closing a window |WinScrolled| after scrolling or resizing a window |VimSuspend| when suspending Vim |VimResume| when Vim is resumed after being suspended New operators: ~ |>>| bitwise right shift |<<| bitwise left shift |??| falsy operator New runtime files: ~ Too many to list here. ============================================================================== INCOMPATIBLE CHANGES *incompatible-9* There is only one change that is incompatible with previous releases: - Lua arrays are now one-based, they used to be zero-based. Note that when using |Vim9| script several things work differently, see |vim9-differences|. ============================================================================== IMPROVEMENTS *improvements-9* Various small and useful improvements have been made since Vim 8.2, here is a summary. Many memory leaks, invalid memory accesses and crashes have been fixed. See the list of patches below: |bug-fixes-9|. Support for Vim expression evaluation in a string. |interpolated-string| Support for evaluating Vim expressions in a heredoc. |:let-heredoc| Support for fuzzy matching: - a string in a List of strings. |fuzzy-matching| - completion support for command line completion using 'wildoptions'. - for |:vimgrep|. Added support for the |Haiku| OS. Support for "lsp" channel mode to simplify LSP server RPC communication |language-server-protocol|. Support for using a Unix domain socket with a |channel|. IPv6 support in channels |channel-address|. Support for sourcing lines from the current buffer. |:source-range| Terminal window improvements: - Support for opening a terminal in a popup window. |popup-terminal| - Allow setting underline color in terminal. - Detect focus events in terminal (|FocusGained| and |FocusLost|). - Add bell support for the terminal window. ('belloff') - Support mouse left-right scrolling in a terminal window. Support for stopping profiling a Vim script: `:profile stop` and dumping the report to a file: `:profile dump` . |:profile| Completion improvements: - Argument completion support for the |:breakadd|, |:breakdel|, |:diffget|, |:diffput|, |:profile|, |:profdel| and |:scriptnames| commands. - Support using any Vim type for user_data with the completion functions (|complete-items|). - Stop insert mode completion without changing text (|i_CTRL-X_CTRL-Z|). - Add the "cmdline" option to |getcompletion()| to return the command line arguments. Support for setting the 'foldtext', 'completefunc', 'omnifunc', 'operatorfunc', 'thesaurusfunc', 'quickfixtextfunc', 'tagfunc', 'imactivatefunc' and 'imstatusfunc' options to a function reference or a lambda function or a script-local function. Support directly setting the 'balloonexpr', 'charconvert' 'foldexpr', 'formatexpr', 'includeexpr', 'printexpr', 'patchexpr', 'indentexpr', 'modelineexpr', 'diffexpr' and 'printexpr' options to a script-local function. Improvements in 'fillchars': - Support for configuring the character used to mark the beginning of a fold, show a closed fold and show a fold separator using "foldopen", "foldclose" and "foldsep" respectively in 'fillchars'. - Support for configuring the character displayed in non existing lines using "eob" in 'fillchars'. - Support for using multibyte items with the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items in the 'fillchars' option. Support for the XChaCha20 encryption method. 'cryptmethod' Spell checking: - Spell check current word with |z=| even when 'spell' is off. - Add "timeout" to 'spellsuggest' to limit the searching time for spell suggestions. - Add support for spell checking CamelCased words by adding "camel" to 'spelloptions'. Support for executing Ex commands in a map without changing the current mode || and ||. Add optional error code to |:cquit|. Recognize numbers as unsigned when "unsigned" is set in 'nrformats'. Expand script ID using expand('') and script name using expand('