aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorVG <vg@devys.org>2015-07-27 14:13:36 +0200
committerVG <vg@devys.org>2015-07-27 14:13:36 +0200
commit5821170d49b6a7a8c94c279808cd2eeba3be920f (patch)
treef89e2e152050a3187deafac97f5eaefe2cd23e67 /plugin
parent15277767ab014231de25270a2cfc1c4178b25ee2 (diff)
downloadvim-uuid-anchor-5821170d49b6a7a8c94c279808cd2eeba3be920f.tar.gz
vim-uuid-anchor-5821170d49b6a7a8c94c279808cd2eeba3be920f.tar.bz2
vim-uuid-anchor-5821170d49b6a7a8c94c279808cd2eeba3be920f.zip
renames ftplugin to plugin since it is not filetype dependent
Diffstat (limited to 'plugin')
-rw-r--r--plugin/uuid_anchor.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugin/uuid_anchor.vim b/plugin/uuid_anchor.vim
new file mode 100644
index 0000000..1e5dfdd
--- /dev/null
+++ b/plugin/uuid_anchor.vim
@@ -0,0 +1,29 @@
+" UUID Anchor vim plugin
+" Language: Python (ft=python)
+" Maintainer: VG <vg@devys.org>
+" Version: Vim 7 (may work with lower Vim versions, but not tested)
+" URL: http://git.devys.org/vim-uuid-anchor
+
+" Only do this when not done yet for this buffer
+if exists("g:loaded_uuid_anchor_ftplugin")
+ finish
+endif
+let loaded_uuid_anchor_ftplugin = 1
+
+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.
+if !exists("no_plugin_maps") && !exists("no_uuid_anchor_maps")
+ if !hasmapto(' CreateAnchorUUID(')
+ imap <leader><leader>uuid <C-o>:call CreateAnchorUUID()<CR>
+ endif
+endif