Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Created March 2, 2012 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marek-saji/1958601 to your computer and use it in GitHub Desktop.
Save marek-saji/1958601 to your computer and use it in GitHub Desktop.
re-use existing gvim window
#!/bin/sh
gvim=gvim
( pidof $( basename "$gvim" ) > /dev/null ) || exec "$gvim" "$1"
dn="$( pwd | sed 's/ /\\ /g' )"
fn="$( echo "$1" | sed 's/ /\\ /g' )"
exec "$gvim" --remote-send "<ESC>:cd ${dn}<CR>:tabnew +cd\ - ${fn}<CR>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment