# vim: ft=python # # Kate Adkins's personal xonshrc # import os import sys import socket # Override this to debug the Xonshrc. XONSHRC_VERBOSE = False # # Overrides for warnings # import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) def warn(*args, **kwargs): pass import warnings warnings.warn = warn # # Xonsh configuration # # Load our Xonsh extensions. xontrib load whole_word_jumping coreutils term_integration sh # Squish down long CWD paths, $DYNAMIC_CWD_WIDTH="30%" $DYNAMIC_CWD_ELISION_CHAR='…' # Allow raw entry of paths; don't require cd. $AUTO_CD=True # Automatically push directories, so we can just popd back. $AUTO_PUSHD=True # Make it easy to type matching parens $XONSH_AUTOPAIR=True # Don't let deprecation warnings spam our console. __import__('warnings').simplefilter('ignore', DeprecationWarning, 882) # # Helpers # def try_source(filename): """ Sources a given file iff that file exists. """ from os import path from xonsh import aliases xshfiles_dir = path.dirname(path.realpath(__file__)) full_file = path.join(xshfiles_dir, filename + ".xsh") if path.exists(full_file): if XONSHRC_VERBOSE: print(f"Sourcing {full_file}!") aliases.source_alias([full_file]) elif XONSHRC_VERBOSE: print(f"Not sourcing {full_file}!") # # Environment # $GCC_COLOR = "auto" $GCC_COLORS = "auto" $EDITOR="kak" $VISUAL="kak" # Start off with some empty local variables; these will hopefully be populated # by files we source. PATH_ADDS = [] # # Per-platform and per-machine environment. # try_source(socket.gethostname().split('.')[0]) try_source(sys.platform) # Note: lower in the list = higher priority for component in PATH_ADDS: $PATH.insert(0, component) # Aliases. aliases['vim']="nvim" aliases['t']="task" aliases['tn']="task next" aliases['ti']='task \'(project="" or +Inbox)\'' aliases['tls']='task ls' aliases['tm']='task mod' # Keep thread-subproces on. $THREAD_SUBPROCS=True # Gulp. try: import pygments.styles.solarized $XONSH_COLOR_STYLE='solarized-dark' if XONSHRC_VERBOSE: print("Loaded color scheme.") except Exception as e: if XONSHRC_VERBOSE: print("Failed to load colors!") print(e)