Last active
August 29, 2015 14:01
-
-
Save amcsi/e5f0c44230dd1566b2c9 to your computer and use it in GitHub Desktop.
Keeping track of Vim nesting
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
# This file is loaded by vim when calling :sh | |
# The purpose of this file is to set up PS1 to show that you are in a shell | |
# opened by vim. | |
source ~/.bashrc | |
export VIMEXTRA='' | |
if [[ -z "$VIMSHELL" ]]; then | |
export VIMSHELL=1 | |
else | |
export VIMSHELL=`expr $VIMSHELL + 1` | |
export VIMEXTRA=" x$VIMSHELL" | |
fi | |
# expecting something like "Attila@Attila-PC:~/.vim (vim) (master *=)$" if within vimshell | |
# and expecting "Attila@Attila-PC:~/.vim (vim x2) (master *=)$" if in a vimshell within a vimshell | |
PS1="\u@\h:\w \[\033[01;31m\](vim$VIMEXTRA)\[\033[01;34m\]\[\033[01;33m\]\$(__git_ps1)\[\033[00m\]\$ " | |
# vim: set filetype=sh : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
escape
$(__git_ps1)
so that it would be resolved on each shell prompt, instead of caching the result.