Created
October 31, 2014 11:02
-
-
Save franklinjavier/54444f53a333cfe87636 to your computer and use it in GitHub Desktop.
vimscp
This file contains hidden or 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 characters
| #!/bin/bash | |
| echo "vim-scp FTW" | |
| if [ $# -ne 2 ]; then | |
| echo "usage : `basename $0` user@host /path" | |
| exit 1 | |
| fi | |
| COMMAND="ssh $1 -f -N -o ControlMaster=auto -p 21 -o ControlPath=/tmp/%r@%h:%p" | |
| echo "opening ssh tunnel.." | |
| $COMMAND || exit $? | |
| echo "ssh tunnel active, opening vim.." | |
| vim scp://$1$2 | |
| echo "closing ssh tunnel.." | |
| ps -ef | grep "$COMMAND" | grep -v grep | awk '{print $2}' | xargs kill -9 | |
| echo "Great Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment