-
Notifications
You must be signed in to change notification settings - Fork 1
/
xonshrc
69 lines (60 loc) · 2.74 KB
/
xonshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Uncomment this for troubleshooting:
# $XONSH_SHOW_TRACEBACK = True
### Setup ###
# `ln -s ~/inventhub/BenBin/xonshrc[_variant] ~/.xonshrc`
# (xonshrc variants should source this file as approprate)
# In Terminal prefs:
# - General > Shells open with: Command /usr/local/bin/xonsh
# - Profiles > Shell > Ask before closing: Only if there are processes other than: xonsh
# In VS Code prefs: Terminal › Integrated › Env: Osx
# "Edit in settings.json" button
# Replace the added `"terminal.integrated.env.osx":` block with:
# "terminal.integrated.profiles.osx": {
# "Xonsh": {
# "path": "/opt/homebrew/bin/xonsh",
# "args": []
# }
# },
# "terminal.integrated.defaultProfile.osx": "Xonsh",
# Comment this out to see instructions for not skipping redundant aliases
$FOREIGN_ALIASES_SUPPRESS_SKIP_MESSAGE = True
# XONSH WIZARD START
source-bash "echo loading xonsh foreign shell"
xontrib load coreutils vox
# XONSH WIZARD END
### Path ###
$PATH[0:0] = [
"/opt/homebrew/bin",
"/opt/homebrew/sbin",
"/usr/local/opt/python3/bin/",
"/usr/local/bin",
"/usr/sbin",
]
$PATH.extend([
"~/inventhub/allgit",
"~/inventhub/bettergit",
"~/inventhub/BenBin",
"~/scripts",
"~/bin",
])
### Imports ###
import re
# [DeprecationWarning: There is no current event loop · Issue #1696 · prompt-toolkit/python-prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1696)
# [Prompt toolkit broke after update · Issue #5016 · xonsh/xonsh](https://github.com/xonsh/xonsh/issues/5016)
__import__('warnings').filterwarnings('ignore', 'There is no current event loop', DeprecationWarning, 'prompt_toolkit.eventloop.utils')
### Prompt ###
# Left-prompt is constant char+space to maximize space and eliminate start-of-line noise; all info goes in the right-prompt
# Right-prompt starts with constant char; this will allow relatively easy parsing of copied terminal lines
if [ int(n) for n in $XONSH_VERSION.split(".") ] >= [0, 9, 23]:
$PROMPT = "{BOLD_BLUE}{last_return_code_if_nonzero:{BOLD_RED}}⫸{RESET} "
$MULTILINE_PROMPT = "{BOLD_BLUE}…{RESET}"
$RIGHT_PROMPT = '{BOLD_BLUE}{last_return_code_if_nonzero:{BOLD_RED}}●{last_return_code_if_nonzero: {RED}[{}]}{RESET}{env_name}{branch_color}{curr_branch: {}} {BLUE}{cwd}{RESET}'
else: # HACK: remove this once RPi is on v0.9.23+
$PROMPT = "{ret_code_color}⮞{NO_COLOR} " # HACK: RPi doesn't have triple-nested-greater-than :'(
$MULTILINE_PROMPT = "{BOLD_BLUE}…{NO_COLOR}"
$RIGHT_PROMPT = '{ret_code_color}●{NO_COLOR}{env_name}{branch_color}{curr_branch: {}} {BLUE}{cwd}{NO_COLOR}'
$DYNAMIC_CWD_WIDTH = "30%"
$DYNAMIC_CWD_ELISION_CHAR = "…"
### Aliases ###
source ~/inventhub/BenBin/xonsh_aliases.xsh
###