Created
January 15, 2014 19:09
-
-
Save jonmorehouse/8442341 to your computer and use it in GitHub Desktop.
UUID generator for vim. Inputs a uuid to copy buffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works great! FYI I had to change
to
to get it to work. C.f. https://github.com/ensime/ensime-vim/issues/306#issuecomment-359591407