Today I’ve discovered a really nice feature in vim. Sometimes it is nice to inject the output of a shell command into the current text, like the current date and time.

You can use the :read command for that. Like this:

:read !date

Afar from date there are a plenty of use cases I can imagine of, like ls, tree, diff, cat(!).

Thanks to Vim!

One Response to “Inject the output of a shell command into the current text in Vim”

  1. Herod Says:

    it works with any command

    :read !anycommand

    and if you want you can also try

    :!anycommand to call a shell comm while on vim

    pretty cool yeah 😀

Leave a Reply