Skip to content

Instantly share code, notes, and snippets.

@rbtnn
Created October 20, 2013 06:06
Show Gist options
  • Save rbtnn/7065519 to your computer and use it in GitHub Desktop.
Save rbtnn/7065519 to your computer and use it in GitHub Desktop.
function! s:vim_version() " {{{
redir => lines
silent! version
redir END
let m1 = []
let m2 = []
let regex1 = '^VIM - Vi IMproved \(\d\+.\i\+\) '
let regex2 = '^Included patches: \(\d\+\)-\(\d\+\)'
for line in split(lines,"\n")
if line =~# regex1
let m1 = matchlist(line,regex1)
endif
if line =~# regex2
let m2 = matchlist(line,regex2)
endif
endfor
return printf('%s.%04s', m1[1], m2[2])
endfunction " }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment