Browse Source

set $SHLVL; prompt: repeat {prompt_end} $/# $SHLVL times

Fabian Peter Hammerle 5 years ago
parent
commit
99a98a591f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      rc.xsh

+ 2 - 1
rc.xsh

@@ -14,6 +14,7 @@ def _last_exit_status():
         return None
 $PROMPT_FIELDS['last_exit_status'] = _last_exit_status
 
+$SHLVL = int($SHLVL) + 1 if 'SHLVL' in ${...} else 1
 $XONSH_STDERR_PREFIX = '{RED}'
 $XONSH_STDERR_POSTFIX = '{NO_COLOR}'
 $DYNAMIC_CWD_WIDTH = '30%'
@@ -22,7 +23,7 @@ $PROMPT = ''.join([
     '{RED}{last_exit_status:[{}] }',
     '{BOLD_GREEN}{user}@{hostname} ',
     '{YELLOW}{cwd} ',
-    '{BLUE}{prompt_end} ',
+    '{{BLUE}}{} '.format('{prompt_end}' * $SHLVL),
     '{NO_COLOR}',
 ])
 $RIGHT_PROMPT = '{gitstatus}{env_name: {}}'