Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UUID generator for vim. Inputs a uuid to copy buffer
fu! GenerateUUID()
python << EOF
import uuid
import vim
# output a uuid to the vim variable for insertion below
vim.command("let generatedUUID = \"%s\"" % str(uuid.uuid4()))
EOF
" insert the python generated uuid into the current cursor's position
:execute "normal i" . generatedUUID . ""
endfunction
"initialize the generateUUID function here and map it to a local command
noremap <Leader>r :call GenerateUUID()<CR>
@theimpostor

This comment has been minimized.

Copy link

theimpostor commented Jul 17, 2018

Works great! FYI I had to change

python << EOF

to

py3 <<EOF

to get it to work. C.f. ensime/ensime-vim#306 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.