UUID’s (universally unique identifiers) are really handy. I use them for all sorts of things, like key props in a React map, and I like to have them easily accessible when writing code.
Today I wrote two Vim mappings to support this workflow. I can shell out to Ruby and use
" Insert a UUID with Ruby nnoremap ruid :read !ruby -e "require 'securerandom'; p SecureRandom.uuid"<cr>
uuid library. I did not have to install
uuid, it was already available to me.
" Insert a UUID with JS nnoremap juid :read !node -e "var uuid = require('uuid'); console.log(uuid.v4())"<cr>