11 févr. 2014

Get CLI results in Vim

Still a nice trick. When you need to get the results from a command line into your documentation, you can use Vim's ability to run Bash / Zsh commands and read their outputs.

For instance, I want to list all the files contained into a directory:
:r ! ls -l my_dir

Another nice example, I want to show the directory tree of my project into my documentation :
:r ! tree -d

Note : On OSX, you can install tree with Homebrew easily:
brew install tree

Aucun commentaire:

Enregistrer un commentaire