Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created October 3, 2011 12:18
Show Gist options
  • Save kaneshin/1258984 to your computer and use it in GitHub Desktop.
Save kaneshin/1258984 to your computer and use it in GitHub Desktop.
" Greatest Common Divisor - vim
command! -nargs=+ GreatestCommonDivisor :echo s:gdb(<f-args>)
function! s:gdb(a, b)
let l:r = a:a % a:b
if l:r
return s:gdb(a:b, l:r)
else
return a:b
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment