diff options
| -rw-r--r-- | plugin/uuid_anchor.vim | 19 | 
1 files changed, 9 insertions, 10 deletions
| diff --git a/plugin/uuid_anchor.vim b/plugin/uuid_anchor.vim index 9da2ceb..5c43557 100644 --- a/plugin/uuid_anchor.vim +++ b/plugin/uuid_anchor.vim @@ -10,8 +10,11 @@ if exists("g:loaded_uuid_anchor_ftplugin")  endif  let loaded_uuid_anchor_ftplugin = 1 +  if has('python')  " python2 is available + +  function! CreateAnchorUUID()  python << EOF  import vim @@ -21,8 +24,12 @@ vim.current.line += generated_uuid  vim.command(''' normal l"uye ''')  EOF  endfunction + +  elseif has('python3')  " python3 is available + +  function! CreateAnchorUUID()  python3 << EOF  import vim @@ -31,19 +38,11 @@ generated_uuid = '{:08X}'.format(random.randint(0,256**4))  vim.current.line += generated_uuid  vim.command(''' normal l"uye ''')  EOF -endif +endfunction +endif -function! CreateAnchorUUID() -python << EOF -import vim -import random -generated_uuid = '{:08X}'.format(random.randint(0,256**4)) -vim.current.line += generated_uuid -vim.command(''' normal l"uye ''') -EOF -endfunction  " Add mappings, unless the user didn't want this.  " The default mapping is registered, unless the user remapped it already. | 
