#1 howto copypaste into vim -- micro-blogpost
how to insert text from bash into vim
Sometimes when bound to hardware and not in comfy remote location I'm working in a command line env. there where no mouse support is available . Typically at OS reinstall. Need to insert an output inside vim editor. An awkward solution come up with is redirect an output in bash to a file which you want to edit , then edit the file which have now the content . For example . : You need a disk UUID in grub.conf, then
#grub-mkconfig -o /boot/grub/grub.cfg #blkid | tee -a uuid #blkid >> /etc/default/grub
A better approach is to read and insert a command output into vim :
:r!blkid :r!ls /path/to/file or read an entire file : :r /path/to/file
Read in command mode will insert the contents of another file, or the output of a command into a vim buffer (file).