Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created August 12, 2011 19:24
Show Gist options
  • Save kyleterry/1142778 to your computer and use it in GitHub Desktop.
Save kyleterry/1142778 to your computer and use it in GitHub Desktop.
#!/bin/sh
if test -n "$DISPLAY"; then
desktop="SERVER$(wmctrl -d | grep '\*' | cut -f 1 -d ' ')"
vim --serverlist | grep $desktop
if [ $? -eq 1 ]
then
vim --servername $desktop $*
else
vim --servername $desktop --remote $*
fi
else
vim $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment