Skip to content

Commit bea8f29

Browse files
committed
correct vim9script syntax
1 parent 8083755 commit bea8f29

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

vim9script.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -194,40 +194,31 @@ echo "0xA" + 1 # Number
194194
# Variables
195195
# ###########
196196
197-
var b_my_var = 1 # Local to current buffer
198-
var w_my_var = 1 # Local to current window
199-
var t_my_var = 1 # Local to current tab page
200-
var g_my_var = 1 # Global variable
201-
var l_my_var = 1 # Local to current function
202-
var s_my_var = 1 # Local to current script file
203-
var a_my_arg = 1 # Function argument
204-
205-
# The Vim scope is read-only
206-
echo true # Special built-in Vim variables
197+
var b:my_var = 1 # Local to current buffer
198+
var w:my_var = 1 # Local to current window
199+
var t:my_var = 1 # Local to current tab page
200+
var g:my_var = 1 # Global variable
207201
208202
# Access special Vim memory like variables
209203
var @a = 'Hello' # Register
210204
var $PATH='' # Environment variable
211205
var &textwidth = 79 # Option
212-
var &l_textwidth = 79 # Local option
213-
var &g_textwidth = 79 # Global option
206+
var &l:textwidth = 79 # Local option
207+
var &g:textwidth = 79 # Global option
214208
215209
# Access scopes as dictionaries
216210
echo b: # All buffer variables
217211
echo w: # All window variables
218212
echo t: # All tab page variables
219213
echo g: # All global variables
220-
echo l: # All local variables
221-
echo s: # All script variables
222-
echo a: # All function arguments
223214
echo v: # All Vim variables
224215
225216
# Constant variables
226217
const x = 10 # Constant
227218
228219
# Function reference variables
229220
var IsString = {x -> type(x) == type('')} # Global
230-
var s_isNumber = {x -> type(x) == type(0)} # Local
221+
var isNumber = {x -> type(x) == type(0)} # Local
231222
232223
# Multiple value binding
233224
var [x, y] = [1, 2]
@@ -448,5 +439,5 @@ endif
448439
var g_loaded_my_plugin = true
449440
450441
# Default values
451-
var s_greeting = get(g:, 'my_plugin_greeting', 'Hello')
442+
var greeting = get(g:, 'my_plugin_greeting', 'Hello')
452443
```

0 commit comments

Comments
 (0)