123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- $VI_MODE = True
- $AUTO_PUSHD = True
- $XONSH_AUTOPAIR = True
- # tab selection: do not execute cmd when pressing enter
- $COMPLETIONS_CONFIRM = True
- xontrib load vox z
- def _last_exit_status():
- try:
- exit_status = __xonsh_history__.rtns[-1]
- return exit_status if exit_status != 0 else None
- except IndexError:
- return None
- $PROMPT_FIELDS['last_exit_status'] = _last_exit_status
- $XONSH_STDERR_PREFIX = '{RED}'
- $XONSH_STDERR_POSTFIX = '{NO_COLOR}'
- $DYNAMIC_CWD_WIDTH = '30%'
- $PROMPT = ''.join([
- '{RED}{last_exit_status:[{}] }',
- '{BOLD_GREEN}{user}@{hostname} ',
- '{YELLOW}{cwd} ',
- '{BLUE}{prompt_end} ',
- '{NO_COLOR}',
- ])
- $RIGHT_PROMPT = '{gitstatus}{env_name: {}}'
- import datetime as dt
- import dateutil.tz
- import os
- import re
- import shutil
- $EDITOR = 'vim'
- # required by pinentry-tty when using gpg command:
- $GPG_TTY = $(tty)
- if shutil.which('gpgconf'):
- # required by scute
- $GPG_AGENT_INFO = $(gpgconf --list-dir agent-socket).rstrip() + ':0:1'
- if not 'SSH_CLIENT' in ${...}:
- # in gnupg 2.1.13 the location of agents socket changed
- $SSH_AUTH_SOCK = $(gpgconf --list-dir agent-ssh-socket).rstrip()
- # wrapper for termite required when launching termite from ranger:
- $TERMCMD = os.path.join(os.path.dirname(__file__), 'ranger-termite-termcmd')
- def locate(*patterns, match_all=True, ignore_case=True):
- params = []
- if match_all:
- params.insert(0, '--all')
- if ignore_case:
- params.insert(0, '--ignore-case')
- return $(locate @(params) -- @(patterns)).split('\n')[:-1]
- def timestamp_iso():
- return dt.datetime.now(tz=dateutil.tz.tzlocal()) \
- .strftime('%Y%m%dT%H%M%S%z')
- aliases['g'] = ['git']
- aliases['ll'] = ['ls', '-l', '--all', '--indicator-style=slash',
- '--human-readable', '--time-style=long-iso', '--color=auto']
- # vim: filetype=python
|