Created
August 28, 2015 13:36
-
-
Save tobyS/a8631772582924db4668 to your computer and use it in GitHub Desktop.
Re-attach to an existing VIM session in a new tab
This file contains 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 | |
# alias vim="vimmux" | |
export TERM="xterm-256color" | |
if tmux has-session -t vim | |
then | |
if [ "$#" != "1" ] | |
then | |
echo "There is another VIM session in TMUX and we cannot open tabs with multiple parameters. Do manually!" | |
exit 1; | |
fi | |
file=$(readlink -f $1) | |
tmux send-keys -t vim:vim ":tabe $file" C-m | |
tmux attach-session -t vim | |
exit 1; | |
fi | |
tmux -2 new-session -s vim -n vim "vim $@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment