Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tried writing it vim9script

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for yasunori yasunori
November 09, 2025
17

Tried writing it vim9script

Avatar for yasunori

yasunori

November 09, 2025
Tweet

Transcript

  1. Motivation • The Neovim I use daily is fairly customized.

    • I want to customize the original Vim for minimalist use. ◦ skkeleton only for VIME(Vim Input Method Editor) ◦ other temporary use etc... • vim9script is apparently faster than vim script. • I wanted to configure dpp.vim with vim9script
 Why writing vim9script
 BTW, dpp is "Dark Powered Plugin manager". And to use dpp.vim. • denops.vim is required • Building a minimal plugin manager ◦ Plugin download ◦ Add plugin path to runtimepath
 • Multiple autocmd declarations • other a lot of configuration... ◦ TypeScript ◦ vimrc in Vim or Neovim
  2. pros • Syntax from popular languages is being adopted. (see

    :h vim9-rationale) ◦ A lambda expression declared like a JavaScript/TypeScript arrow function. ◦ Comments starting with # and function declarations were adopted to mimic Python. • Change from dynamic typing to static typing. (see :h vim9-types) ◦ Strict type specification is required for arguments and return values. (see :h E1096) ◦ Changes in how variable length arguments are declared. (see :h vim9-variable-arguments) ◦ Generics functions can be declared and flexible typing is possible. (see :h generic-functions) Let's try writing vim9script!!
  3. • When continuing a line, a backslash is no longer

    required at the beginning of the continuation line. (see :h vim9-line-continuation) ◦ In addition to arrays and dictionaries, function arguments, method chains using -> and . no longer require continuation. • All functions are defined script local. (see :h vim9script) ◦ Functions declared using export or import can be called from outside. • Object-oriented programming is now possible with the addition of class. ◦ Since you can use abstract class and interface class, you can create various objects. • Classes and functions can now be compiled, and execution speed can be expected to be improved by 10 to 100 times. (see :h Vim9-script) ◦ Functions and classes that are called externally can be compiled with defcompile. (see :h :defcompile)
  4. cons • It does not work with Neovim. ◦ Neovim

    official also states that vim9script is not supported. (see :h Vim9script in Neovim) • Can only be used after Vim9 and is not backward compatible. ◦ Use the latest Vim! ◦ LATEST!! You can solve everything by using the latest version!! ◦ Check with echo has('vim9script')!!! • LSP implementation does not exist. ◦ Even if you declare a class, it's painful because you can't complement the internal methods and properties. ◦ If you can input the declared class structure into your brain, in a sense, does this mean awaken to the text editor...? But vim9script is not perfect either.
  5. points to note • vim9script is a practical but still

    under development feature. ◦ :h vim9class.txt also includes To be done later. ◦ :h :++ also includes in an expression is not supported yet.. ◦ etc... • Must be write vim9script at first line. (see :h E1170) ◦ It runs as vim9script from the line below where you written vim9script. • Handling of null_<type> of each type is special. (see :h null) ◦ There's a lot of documentation about null, so feel free to read it ;-) Make sure to also check :h vim9

  6. • call and eval are no longer required for function

    calls. (see :h E1190) ◦ Using call is deprecated. ◦ Using eval is also deprecated and will result in an error in some situations. (see :h E1207) • Destructive array operations result in an error. (see: :h E1206) ◦ For functions such as map and filter, operations that change from the original type will result in an error. ◦ Avoid changing the original type using mapnew or copy()->filter(). • When using Funcref as an argument in foreach etc., the lambda expression argument cannot be omitted. (see:h foreach()) ◦ This was a notable pain point.
  7. Conclusion • vim9script is the best configuration element available in

    the LATEST Vim!! • Read lots of help! (see :h help) • Some parts are still under development!! • It has its awkward parts, but if you keep using it, awaken to the text editor...? • Thank you for making the configuration available!!!!