xonshy tweaks
This commit is contained in:
parent
6c0aa6cf9b
commit
303aa928dc
1 changed files with 33 additions and 18 deletions
|
|
@ -1,20 +1,37 @@
|
||||||
## ALIASES ##
|
## ALIASES ##
|
||||||
|
# home network utils
|
||||||
aliases["tsla-fan"] = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"
|
aliases["tsla-fan"] = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"
|
||||||
|
aliases["weboot"] = "bash -c 'nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot'"
|
||||||
|
|
||||||
|
# nixos helpers
|
||||||
aliases["nixoss"] = "sudo nixos-rebuild switch --flake @('.#' + $(hostname))"
|
aliases["nixoss"] = "sudo nixos-rebuild switch --flake @('.#' + $(hostname))"
|
||||||
aliases["nixost"] = "sudo nixos-rebuild test --flake @('.#' + $(hostname))"
|
aliases["nixost"] = "sudo nixos-rebuild test --flake @('.#' + $(hostname))"
|
||||||
aliases["nixosb"] = "sudo nixos-rebuild build --flake @('.#' + $(hostname))"
|
aliases["nixosb"] = "sudo nixos-rebuild build --flake @('.#' + $(hostname))"
|
||||||
aliases["nixos-dry"] = "sudo nixos-rebuild dry-build --flake @('.#' + $(hostname))"
|
aliases["nixos-dry"] = "sudo nixos-rebuild dry-build --flake @('.#' + $(hostname))"
|
||||||
|
|
||||||
|
# devenv
|
||||||
aliases["init-python"] = "nix flake update --flake templates && nix flake init -t 'templates#python' && direnv allow"
|
aliases["init-python"] = "nix flake update --flake templates && nix flake init -t 'templates#python' && direnv allow"
|
||||||
aliases["weboot"] = "bash -c 'nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot'"
|
|
||||||
|
# utilities
|
||||||
aliases["ls"] = "exa"
|
aliases["ls"] = "exa"
|
||||||
aliases["ll"] = "exa -lah"
|
aliases["ll"] = "exa -lah"
|
||||||
aliases["grep"] = "rg"
|
aliases["grep"] = "rg"
|
||||||
|
aliases["op"] = "xdg-open"
|
||||||
|
|
||||||
|
# scrips
|
||||||
aliases["theo"] = "python ~/.config/xonsh/theo.py"
|
aliases["theo"] = "python ~/.config/xonsh/theo.py"
|
||||||
aliases["kittycatsay"] = "python ~/.config/xonsh/kittycatsay.py"
|
aliases["kittycatsay"] = "python ~/.config/xonsh/kittycatsay.py"
|
||||||
|
|
||||||
|
# Kitty helpers
|
||||||
|
aliases["kicat"] = "kitten icat"
|
||||||
|
aliases["kissh"] = "kitten ssh"
|
||||||
|
aliases["kidiff"] = "kitten diff"
|
||||||
|
|
||||||
|
|
||||||
## INTERACTIVE CONFIGURATION ##
|
## INTERACTIVE CONFIGURATION ##
|
||||||
if $XONSH_INTERACTIVE:
|
if $XONSH_INTERACTIVE:
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from xonsh.built_ins import XSH
|
||||||
import importlib.util
|
import importlib.util
|
||||||
t0 = datetime.now()
|
t0 = datetime.now()
|
||||||
|
|
||||||
|
|
@ -22,15 +39,18 @@ if $XONSH_INTERACTIVE:
|
||||||
$XONSH_COLOR_STYLE = 'native'
|
$XONSH_COLOR_STYLE = 'native'
|
||||||
$PROMPT = '{YELLOW}{env_name}{RESET}{BOLD_GREEN}{user}@{hostname} {cwd}{branch_color}{curr_branch: {}}{RESET} {RED}{last_return_code_if_nonzero:[{BOLD_INTENSE_RED}{}{RED}] }{RESET}{BOLD_BLUE}{prompt_end}{RESET} '
|
$PROMPT = '{YELLOW}{env_name}{RESET}{BOLD_GREEN}{user}@{hostname} {cwd}{branch_color}{curr_branch: {}}{RESET} {RED}{last_return_code_if_nonzero:[{BOLD_INTENSE_RED}{}{RED}] }{RESET}{BOLD_BLUE}{prompt_end}{RESET} '
|
||||||
|
|
||||||
# Coloured man page support using 'less' env vars
|
# Coloured man page support
|
||||||
$LESS_TERMCAP_mb = "\033[01;31m"
|
# using 'less' env vars (format is '\E[<brightness>;<colour>m')
|
||||||
$LESS_TERMCAP_md = "\033[01;31m"
|
$LESS_TERMCAP_mb = "\033[01;31m" # begin blinking
|
||||||
$LESS_TERMCAP_me = "\033[0m"
|
$LESS_TERMCAP_md = "\033[01;31m" # begin bold
|
||||||
$LESS_TERMCAP_so = "\033[01;44;36m"
|
$LESS_TERMCAP_me = "\033[0m" # end mode
|
||||||
$LESS_TERMCAP_se = "\033[0m"
|
$LESS_TERMCAP_so = "\033[01;44;36m" # begin standout-mode (bottom of screen)
|
||||||
$LESS_TERMCAP_us = "\033[00;36m"
|
$LESS_TERMCAP_se = "\033[0m" # end standout-mode
|
||||||
$LESS_TERMCAP_ue = "\033[0m"
|
$LESS_TERMCAP_us = "\033[00;36m" # begin underline
|
||||||
|
$LESS_TERMCAP_ue = "\033[0m" # end underline
|
||||||
|
|
||||||
$SHELL_THICKENED = "FALSE"
|
$SHELL_THICKENED = "FALSE"
|
||||||
|
|
||||||
## XONTRIB ##
|
## XONTRIB ##
|
||||||
if importlib.util.find_spec("xontrib.coreutils") is not None:
|
if importlib.util.find_spec("xontrib.coreutils") is not None:
|
||||||
xontrib load coreutils
|
xontrib load coreutils
|
||||||
|
|
@ -44,14 +64,10 @@ if $XONSH_INTERACTIVE:
|
||||||
xontrib load bashisms
|
xontrib load bashisms
|
||||||
if importlib.util.find_spec("xontrib.fzf_completions") is not None:
|
if importlib.util.find_spec("xontrib.fzf_completions") is not None:
|
||||||
xontrib load fzf-completions
|
xontrib load fzf-completions
|
||||||
from xonsh.built_ins import XSH
|
XSH.env['fzf_history_binding'] = "c-r"
|
||||||
XSH.env['fzf_history_binding'] = "c-r" # Ctrl+R
|
|
||||||
XSH.env['fzf_ssh_binding'] = "c-s" # Ctrl+S
|
|
||||||
XSH.env['fzf_file_binding'] = "c-t" # Ctrl+T
|
|
||||||
XSH.env['fzf_dir_binding'] = "c-g" # Ctrl+G
|
|
||||||
|
|
||||||
## THICC SHELL
|
## THICC SHELL ##
|
||||||
if $SHELL_THICCNESS == "HIGH" and not $SHELL_THICKENED == "TRUE":
|
if XSH.env.get("SHELL_THICCNESS", "LOW") == "HIGH" and not XSH.env.get("SHELL_THICKENED", "FALSE") == "TRUE":
|
||||||
t0_0 = datetime.now()
|
t0_0 = datetime.now()
|
||||||
# Standard Library Imports
|
# Standard Library Imports
|
||||||
import os
|
import os
|
||||||
|
|
@ -78,8 +94,7 @@ if $XONSH_INTERACTIVE:
|
||||||
xonsh_rc_path = $XONSHRC[0]
|
xonsh_rc_path = $XONSHRC[0]
|
||||||
aliases["thicken-shell"] = f"export SHELL_THICCNESS=HIGH && source {xonsh_rc_path}"
|
aliases["thicken-shell"] = f"export SHELL_THICCNESS=HIGH && source {xonsh_rc_path}"
|
||||||
|
|
||||||
## THEO GREETING ##
|
## SHELL GREETING ##
|
||||||
hour = t0.hour
|
|
||||||
theo | kittycatsay
|
theo | kittycatsay
|
||||||
dt = round((datetime.now() - t0).microseconds/1000000, 2)
|
dt = round((datetime.now() - t0).microseconds/1000000, 2)
|
||||||
if $SHELL_THICKENED == "TRUE":
|
if $SHELL_THICKENED == "TRUE":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue