Piping files to gvim

by jenny on 02 December 2013 - 07:28pm in

Pipe an old version of a file to gvim and set filetype for syntax highlighting:

git show 1a2b3c:foobar.js | gvim "+set filetype=javascript" -

Fill the buffer with the output of a command and set a filename for later saving (:w):

ls -l | gvim "+file ~/foobar.txt" -

Alternate approach to above:

gvim '+r ! ls -l' ~/foobar.txt

Found the last two tricks here.