xonsh / xonsh

:shell: Python-powered shell. Full-featured and cross-platform.
http://xon.sh
Other
8.31k stars 634 forks source link

{vte_new_tab_cwd} not recognized by VTE terminal #2986

Closed mogenson closed 5 years ago

mogenson commented 5 years ago

xonfig

+------------------+-----------------+
| xonsh            | 0.8.8           |
| Python           | 3.7.2           |
| PLY              | 3.11            |
| have readline    | True            |
| prompt toolkit   | 2.0.7           |
| shell type       | prompt_toolkit2 |
| pygments         | 2.3.1           |
| on posix         | True            |
| on linux         | True            |
| distro           | arch            |
| on darwin        | False           |
| on windows       | False           |
| on cygwin        | False           |
| on msys2         | False           |
| is superuser     | False           |
| default encoding | utf-8           |
| xonsh encoding   | utf-8           |
| encoding errors  | surrogateescape |
+------------------+-----------------+

xonshrc

$PROMPT = '{vte_new_tab_cwd}' + $PROMPT

Expected Behavior

Navigate to a directory. Open a new terminal tab. New terminal tab will start in current working directory of old tab.

Current Behavior

I've tried two computers and two VTE terminals: Gnome Terminal opens to ~ and Tilix complains about the missing VTE configuration. Note: on both terminals I've set new tabs to run the xonsh command instead of a login shell. My login shell is still set to bash. Any suggestions on how to debug this?

tilix

mogenson commented 5 years ago

Problem was that $HOSTNAME was not set. $HOSTNAME is usually set by bash, but explicitly setting it in .xonshrc works as well.

scopatz commented 5 years ago

Ahh interesting. We could have HOSTNAME be added to the default environment, if you'd like.

hmaarrfk commented 5 years ago

I tried adding hostname, but it seems to have no effect on gnome-terminal

tilix sets the new working directory to the same as the previous terminal.

my `.xondarc` ```python $PATH = ["$HOME/miniconda3/bin"] + $PATH xontrib load xonda $PROMPT_FIELDS['env_name'] = lambda: "("+$CONDA_DEFAULT_ENV+")" if 'CONDA_DEFAULT_ENV' in __xonsh__.env else None def prompt_end(): s = '\n' if __xonsh__.history and __xonsh__.history[-1].rtn !=0: s += '{BOLD_RED}' s += '$ ' return s $PROMPT_FIELDS['prompt_end'] = prompt_end $XONSH_GITSTATUS_STASHED = '⚑ ' $XONSH_GITSTATUS_STAGED = '{RED}● ' $PROMPT = '{env_name:{} }{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd} {gitstatus}{NO_COLOR} {BOLD_BLUE}{prompt_end}{NO_COLOR}' $PROMPT = '{vte_new_tab_cwd}' + $PROMPT with open('/etc/hostname', 'r') as f: $HOSTNAME = f.readline().strip() import warnings warnings.filterwarnings('ignore', category=DeprecationWarning) stty -ixon ```