Skip to content

Instantly share code, notes, and snippets.

@retorillo
Created January 28, 2017 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retorillo/24efee9421bae7e81cb80e3e831d65db to your computer and use it in GitHub Desktop.
Save retorillo/24efee9421bae7e81cb80e3e831d65db to your computer and use it in GitHub Desktop.
Vim can throw number

Vim can also throw number. But it will be automatically stringified and stored into v:exception

try
  throw 123
catch
  echo type(v:exception) == type('')
  " will be 1
endtry

Note that Vim will say "using xxx as string" when trying to throw Dictionary, List, or Float types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment