Last active
December 5, 2018 17:23
Revisions
-
nepsilon renamed this gist
Apr 12, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nepsilon created this gist
Apr 12, 2017 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # 3 Vim tips with external commands Vim has this `!` special character that will run any shell command without having to close it. Here are 3 ways I often use it: **1. Format a JSON blob:** ``` :%!python -m json.tool ``` **2. Count number of characters in a file:** ``` :! wc -c % ``` **3. Load a directory listing:** ``` :r ! ls -1 /my/dir ``` The possibilities are virtually unlimited. Remember `%` will be replaced with the current filename, and `:r` (`:read`) will copy the output of what follows into the current file.