💾 Archived View for gmi.noulin.net › vim › usr › usr_52.gmi captured on 2024-08-19 at 03:52:14. Gemini links have been rewritten to link to archived content
View Raw
More Information
⬅️ Previous capture (2023-01-29)
🚧 View Differences
-=-=-=-=-=-=-
- usr_52.txt* For Vim version 9.1. Last change: 2024 Jun 09
VIM USER MANUAL - by Bram Moolenaar
Write larger plugins
When plugins do more than simple things, they tend to grow big. This file
explains how to make sure they still load fast and how to split them up in
smaller parts.
|52.1| Export and import
|52.2| Autoloading
|52.3| Autoloading without import/export
|52.4| Other mechanisms to use
|52.5| Using a Vim9 script from legacy script
|52.6| Vim9 script examples: comment package, highlight-yank plugin
Next chapter: |usr_90.txt| Installing Vim
Previous chapter: |usr_51.txt| Create a plugin
Table of contents: |usr_toc.txt|
==============================================================================
Vim9 script was designed to make it easier to write large Vim scripts. It
looks more like other script languages, especially Typescript. Also,
functions are compiled into instructions that can be executed quickly. This
makes Vim9 script a lot faster, up to a 100 times.
The basic idea is that a script file has items that are private, only used
inside the script file, and items that are exported, which can be used by
scripts that import them. That makes very clear what is defined where.
Let's start with an example, a script that exports one function and has one
private function: >
vim9script
export def GetMessage(count: string): string
var nr = str2nr(count)
var result =