diff options
author | vg <vg@devys.org> | 2018-05-23 11:40:10 +0200 |
---|---|---|
committer | vg <vg@devys.org> | 2018-05-23 11:40:10 +0200 |
commit | b37a8302ebaa8b5a2ca0b83bb0018c895e8212b3 (patch) | |
tree | fcb4b6499a692b4a0431dcbddc244472adb30705 /plugin | |
parent | ba1da9fe2165d6af64a8b065c9a46d82eaa159d6 (diff) | |
download | vim-uuid-anchor-b37a8302ebaa8b5a2ca0b83bb0018c895e8212b3.tar.gz vim-uuid-anchor-b37a8302ebaa8b5a2ca0b83bb0018c895e8212b3.tar.bz2 vim-uuid-anchor-b37a8302ebaa8b5a2ca0b83bb0018c895e8212b3.zip |
Diffstat (limited to 'plugin')
-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. |