-
Notifications
You must be signed in to change notification settings - Fork 1
/
.xonshrc
executable file
·99 lines (72 loc) · 3.32 KB
/
.xonshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import time
import os
def show_custom_help():
snippets = [
('environment variables', '$HOME, $PATH'),
('Unset environment variable', 'del $GOAL'),
('Complete environment', '${...}'),
('Check if environment variable exists', '\'HOME\' in ${...}'),
('Get help about a specific environment variable', '${...}.help(\'HOME\')'),
('Temporarily set environment variable', 'with ${...}.swap(SOMEVAR=\'foo\'): ...'),
('Construct environment name programatically', '${python expression}'),
('Execute and capture subprocess, output as string', 'output = $(command here) or !(...)'),
('Uncaptured subprocess, output to screen', 'output = $[command here] or ![...]'),
('Getting return code of processs', 'Use ![] !() instead of $[] $()')
]
prompt_len = max(len(line[0]) for line in snippets)
print()
for prompt, code in snippets:
print(f'{" " * (prompt_len - len(prompt))} {prompt} {code}\n')
def _define(args):
word = ''
if isinstance(args, list):
word = ' '.join(args)
elif isinstance(args, str):
word = args
$[dict @(word)]
$[espeak -ven-uk-rp -s 120 @(word)]
def dark_theme():
$[gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark']
def append_to_path(dir):
dir = dir.strip()
if dir not in $PATH:
$PATH.append(dir)
append_to_path('~/.local/bin/')
aliases['define'] = _define
aliases['xh'] = show_custom_help
aliases['ll'] = 'exa -lhaF'
aliases['l'] = 'exa -aFG'
aliases['tree'] = 'exa -lhaFT'
aliases['gis'] = 'git status -s'
aliases['gl'] = '''git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all'''
aliases['gll'] = '''git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all'''
aliases['grep'] = 'grep -i --color=always'
aliases['mkdir'] = 'mkdir -pv'
aliases['find'] = 'fdfind'
aliases['du'] = 'dust'
aliases['cat'] = 'batcat'
aliases['top'] = 'htop'
aliases['rm'] = 'rm -iv'
aliases['cfg'] = 'git --git-dir=~/.cfg/ --work-tree=~/'
aliases['toggle'] = 'bash ~/utils/toggle_capslock_once.sh'
aliases['pycharm'] = 'pycharm-professional'
aliases['suspend'] = 'sudo pm-suspend'
$XONSH_HISTORY_MATCH_ANYWHERE = True
$XONSH_SHOW_TRACEBACK=True
$LS_COLORS='rs=0:di=01;36:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:'
xontrib load apt_tabcomplete
xontrib load autovox
# xontrib load docker_tabcomplete
xontrib load powerline2
xontrib load readable-traceback
xontrib load vox
xontrib load pyenv
# Coloured man page support
# using 'less' env vars (format is '\E[<brightness>;<colour>m')
$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
$LESS_TERMCAP_us = "\033[00;36m" # begin underline
$LESS_TERMCAP_ue = "\033[0m" # end underline