I use :r !uuidgen
frequently to insert a new uuid into the buffer. This works, but I am generally attempting to insert the uuid between quotes, and :r !uuidgen
prints the uuid on a new line.
To get around this issue, I am currently using a simple keymap:
nnoremap <C-u> mm:r!uuidgen<CR>dW"_dd`mp
This macro sets the mark mm
, inserts the uuid r!uuidgen
, deletes the inserted uuid dW
, deletes the extra line "_dd
, goes back to the mark BACKTICKm
, and finally paste the uuid p
.
Is there a way to :r
right after the cursor without this macro/keybinding that wastes a register?