dots/.xonshrc

79 lines
1.8 KiB
Text
Raw Normal View History

2021-09-23 01:38:18 +00:00
# general shit
2021-09-22 03:46:08 +00:00
$PROMPT = '{RED} <3 {RESET}| {BOLD_GREEN}{cwd_base}{RESET} ) '
2021-09-25 19:08:51 +00:00
$XONSH_COLOR_STYLE = 'default'
2021-09-22 03:46:08 +00:00
xontrib load apt_tabcomplete argcomplete autovox jedi z
2021-09-22 07:52:45 +00:00
# path stuff
2021-10-20 03:09:24 +00:00
def load_path():
import sys
$PATH.extend([
'~/addins',
'~/.local/bin',
'~/bin',
'~/go/bin'
])
sys.path.insert(0, '')
load_path()
2021-09-22 07:52:45 +00:00
2021-09-23 01:38:18 +00:00
import addins # my extra stuffs :p
def _colortest():
import sys
for i in range(256):
sys.stdout.write(f"\033[48;5;{i}m ")
if (i+1) % 16 == 0:
sys.stdout.write("\033[0m\n")
# tmux
2021-09-25 19:08:51 +00:00
if !(which tmux) and $TERM != 'tmux-256color':
folder = p'.'
tmux -2 new-session -A -s @(folder.resolve().name)
exit
2021-09-22 07:52:45 +00:00
2021-09-22 03:46:08 +00:00
# debug
def _debug():
if $XONSH_SHOW_TRACEBACK:
$XONSH_SHOW_TRACEBACK = False
print("Debug mode disabled.")
else:
$XONSH_SHOW_TRACEBACK = True
print("Debug mode enabled.")
# bitwarden shit
2021-10-20 03:09:24 +00:00
def _bwc(object : str, bw_id: str):
2021-09-22 03:46:08 +00:00
if p'~/.bw_session'.exists():
if $XONSH_SHOW_TRACEBACK:
print("loaded .bw_session")
source ~/.bw_session
2021-09-23 01:38:18 +00:00
else:
raise FileNotFoundError("~/.bw_session")
2021-10-20 03:09:24 +00:00
output = $(bw get @(object) @(bw_id))
2021-09-22 03:46:08 +00:00
$(echo @(output) | xclip -sel clipboard)
2021-10-20 03:09:24 +00:00
if "password" in object and !(bw get totp @(object[1]) a> /dev/null):
input("totp found, press any key to copy totp ")
output = $(bw get totp @(object[1]))
$(echo @(output) | xclip -sel clipboard)
# return output
2021-09-22 03:46:08 +00:00
2021-09-23 01:38:18 +00:00
# aliases
aliases.update({
'bwg': _bwc,
'bwc': _bwc,
'colortest': _colortest,
'config': '/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME',
'debug': _debug,
'ls': 'ls -alhs --color=auto',
':q': 'exit',
2021-10-20 03:09:24 +00:00
'owo': 'echo uwu',
2021-09-23 01:38:18 +00:00
})
2021-09-22 07:52:45 +00:00
2021-09-23 01:38:18 +00:00
# man page colors :O
$LESS_TERMCAP_mb = "\033[01;31m" # begin blinking
$LESS_TERMCAP_md = "\033[01;31m" # begin bold
$LESS_TERMCAP_me = "\033[0m" # end mode
$LESS_TERMCAP_so = "\033[01;44;36m" # begin standout-mode (bottom of screen)
$LESS_TERMCAP_se = "\033[0m" # end standout-mode
2021-09-25 19:08:51 +00:00