Skip to content

Instantly share code, notes, and snippets.

@nkpart
Created December 13, 2011 00:45
Show Gist options
  • Save nkpart/1469858 to your computer and use it in GitHub Desktop.
Save nkpart/1469858 to your computer and use it in GitHub Desktop.
Ghetto running of commands in separate shells from Vim

In one terminal, run out_pipe.

From vim:

:call PipeCommand("echo " . expand("%"))

See the current file name being printed out by out_pipe.

Win.

#! /bin/bash
tail -F ~/tmp/commands | while read data; do
[ -z "$data" ] && continue
clear
echo $data
sh -c "${data}"
done
function! PipeCommand(cmd)
let cwd = fnamemodify('.', ':p')
let full_cmd = "cd " . cwd . " && " . a:cmd
exe "silent !echo \"" . full_cmd . "\" > ~/tmp/commands"
exe "silent !echo > ~/tmp/commands"
exe "redraw!"
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment