nix/home/dots/xonshrc.py
2023-09-11 21:49:34 +10:00

63 lines
2.4 KiB
Python

# nix fix
import os.path
if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"):
$NIX_REMOTE="daemon"
$NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER
$NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile"
$NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
$NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels"
$PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"]
# prompt
execx($(/run/current-system/sw/bin/starship init xonsh --print-full-init))
# envs
$AUTO_CONTINUE = True
$AUTO_CD = True
$DOTGLOB = True
$GLOB_SORTED = True
$INDENT = ' '
$AUTO_SUGGEST = True
$AUTO_SUGGEST_IN_COMPLETIONS = True
$VI_MODE = True
$XONSH_AUTOPAIR = True
$XONSH_COPY_ON_DELETE = True
$ALIAS_COMPLETIONS_OPTIONS_BY_DEFAULT = True
$CASE_SENSITIVE_COMPLETIONS = False
$COMPLETIONS_BRACKETS = True
$COMPLETION_IN_THREAD = True
# aliases
def la_culr(dir=""):
exa -lha --icons --group-directories-first --color=always @(dir) | culr -t 80 -o roygbiv-split
def ls_culr(dir=""):
exa -lh --icons --group-directories-first --color=always @(dir) | culr -t 80 -o roygbiv-split
def ps_culr(opts=""):
ps ww @(opts) | culr -t 80 -o roygbiv-split
aliases["fresh"] = [ "clear;", "echo;", "~/.nix/header.sh" ]
aliases["icat"] = [ "kitty", "+kitten", "icat" ]
aliases["chmox"] = [ "chmod", "+x" ]
aliases["gs"] = [ "git", "status" ]
aliases["gcl"] = [ "git", "clone" ]
aliases["ga"] = [ "git", "add" ]
aliases["gcb"] = [ "git", "checkout", "-b" ]
aliases["gco"] = [ "git", "checkout" ]
aliases["gl"] = [ "git", "pull" ]
aliases["gp"] = [ "git", "push" ]
aliases["gd"] = [ "git", "diff" ]
aliases["gcam"] = [ "git", "commit", "-am" ]
aliases["gcm"] = [ "git", "commit", "-m" ]
aliases["gr"] = [ "git", "restore" ]
aliases["gm"] = [ "git", "merge" ]
aliases["l"] = [ "ls_culr" ]
aliases["la"] = [ "la_culr" ]
aliases["p"] = [ "ps_culr" ]
aliases["mnt"] = [ "mount", "|", "column", "-t", "|", "culr", "-t", "80", "-o", "roygbiv-split" ]
aliases["zz"] = [ "z", "$(xplr)" ]
# alias kaboom='printf "type any input if you wish to update\n\npress enter to continue\n"; read upgrade; if [ -n "$upgrade" ]; then echo upgrading..; sudo nix-channel --update; else echo no upgrade!; fi; sudo nixos-rebuild switch -j9 && rm ~/.gtkrc-2.0; home-manager switch && sudo nix-collect-garbage && nix-store --optimise'
# greet
fresh