0

If I run e.g. :var a = 1 from the command line I end up in E1124: "var" cannot be used in legacy vimscript. Running on MacVim 9.0.1276.

Is it normal behavior?

2 Answers 2

1

To use the vim9 script syntax your script must include as the first command vim9script.

vim9script

var a = 1

On the command line to run vim9 script command you have to prefix them with :vim9

:vim9 g:a = 1
2

This is because the commandline runs :legacy-mode by default unless :vim9cmd is used.

2
  • Is there any way to change the default behavior?
    – Barzi2001
    Commented Feb 24, 2023 at 6:47
  • @Barzi2001 Not currently.
    – dza
    Commented Feb 24, 2023 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.