aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugin/uuid_anchor.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugin/uuid_anchor.vim b/plugin/uuid_anchor.vim
index 1e5dfdd..9da2ceb 100644
--- a/plugin/uuid_anchor.vim
+++ b/plugin/uuid_anchor.vim
@@ -10,6 +10,31 @@ 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
+import random
+generated_uuid = '{:08X}'.format(random.randint(0,256**4))
+vim.current.line += generated_uuid
+vim.command(''' normal l"uye ''')
+EOF
+endfunction
+elseif has('python3')
+" python3 is available
+function! CreateAnchorUUID()
+python3 << 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
+endif
+
+
+
function! CreateAnchorUUID()
python << EOF
import vim