2

How to exit .vim script file? I want something like this in my init.vim

if exists('g:vscode')
  "Do not execute rest of init.vim, do not apply any configs
  exit
endif

"...some configs...

Google only searchs exiting from Vim itself...

0

1 Answer 1

6

That's precisely what the Ex command finish is used for.

if exists('g:vscode')
  "Do not execute rest of init.vim, do not apply any configs
  finish
endif

It terminates sourcing of a script file. See :h :finish.

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