Skip to content

Instantly share code, notes, and snippets.

@alfredodeza
Created June 6, 2013 13:01
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 alfredodeza/5721329 to your computer and use it in GitHub Desktop.
Save alfredodeza/5721329 to your computer and use it in GitHub Desktop.
Get the current Python version in Vim
function! PyVersion()
let out = system("python --version")
" Match on the first digit, fallback to 2 if nothing found
let major_version = get(matchlist(out, '\d'), 0, '2')
echo "This is Python version " . major_version
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment