xonsh config
This commit is contained in:
parent
45b99b6b82
commit
f614581025
21 changed files with 466 additions and 100 deletions
|
@ -25,6 +25,7 @@ Some configurations for these tools:
|
|||
- lazygit and tig (git)
|
||||
- lazydocker
|
||||
- asciinema
|
||||
- broot
|
||||
|
||||
You need to install:
|
||||
|
||||
|
@ -67,10 +68,12 @@ You need to install:
|
|||
- vdirsyncer
|
||||
- vlock
|
||||
- bluetuith (but installed by script on debian)
|
||||
- broot (but installed by script on debian)
|
||||
- epr (but installed by script on debian)
|
||||
- lazydocker (but installed by script on debian)
|
||||
- lazygit (but installed by script on debian)
|
||||
- nvimpager (but installed by script on debian)
|
||||
- onefetch (but installed by script on debian)
|
||||
- pms - recent version in go (but installed by script on debian)
|
||||
- poezio-omemo (but installed by script on debian)
|
||||
- poezio-plugins (but installed by script on debian)
|
||||
|
|
|
@ -12,12 +12,10 @@ function fish_prompt --description 'Write out the prompt'
|
|||
set -f color_vcs_text $nightfox_yellow
|
||||
set -f color_vcs_bg $nightfox_bg2
|
||||
set -f char_bind 'E'
|
||||
set -f char_user_cwd '%'
|
||||
set -f char_root_cwd '#'
|
||||
|
||||
set -f last_status $status
|
||||
set -f normal (set_color normal)
|
||||
set -f prompt_status "✔"
|
||||
set -f prompt_status "fish✔"
|
||||
|
||||
set -g __fish_git_prompt_color $nightfox_blue
|
||||
set -g __fish_git_prompt_showstashstate 1
|
||||
|
@ -76,18 +74,16 @@ function fish_prompt --description 'Write out the prompt'
|
|||
or set -lx fish_prompt_pwd_dir_length 0
|
||||
|
||||
# Color the prompt differently when we're root
|
||||
set -f suffix $char_user_cwd
|
||||
if functions -q fish_is_root_user; and fish_is_root_user
|
||||
if set -q fish_color_cwd_root
|
||||
set -f color_cwd $fish_color_cwd_root
|
||||
end
|
||||
set -f suffix $char_root_cwd
|
||||
end
|
||||
|
||||
# Color the prompt in red on error
|
||||
if test $last_status -ne 0
|
||||
set -f color_status $nightfox_red
|
||||
set -f prompt_status "[" $last_status "]"
|
||||
set -f prompt_status "fish✗" $last_status
|
||||
end
|
||||
|
||||
set -f string_env ""
|
||||
|
@ -157,13 +153,11 @@ function fish_prompt --description 'Write out the prompt'
|
|||
echo -n -s (set_color -b $color_vcs_bg $color_vcs_text) (fish_vcs_prompt)
|
||||
echo -n -s (set_color -b normal $color_vcs_bg) '' $normal
|
||||
|
||||
echo -s $normal
|
||||
echo $normal
|
||||
|
||||
echo -n -s (set_color --bold -b $color_bind $color_text) $char_bind
|
||||
echo -n -s (set_color -b $color_cwd $color_bind) ''
|
||||
|
||||
echo -n -s (set_color -b $color_cwd $color_text) $suffix
|
||||
echo -n -s (set_color -b normal $color_cwd) ' ' $normal
|
||||
echo -n -s (set_color -b normal $color_bind) ''
|
||||
echo $normal
|
||||
end
|
||||
|
||||
function fish_right_prompt -d "Right prompt"
|
||||
|
|
0
common/.config/fish/functions/fundle.fish
Normal file → Executable file
0
common/.config/fish/functions/fundle.fish
Normal file → Executable file
0
common/.config/fish/functions/set_nightfox_vars.fish
Normal file → Executable file
0
common/.config/fish/functions/set_nightfox_vars.fish
Normal file → Executable file
|
@ -101,6 +101,18 @@ function update-homes -d "Update homes configuration"
|
|||
echo (set_color 719cd6)"*** Install pyright ***"(set_color normal)
|
||||
echo
|
||||
pip install --user --upgrade --break-system-packages -U pyright
|
||||
|
||||
echo
|
||||
echo
|
||||
echo (set_color 719cd6)"*** Install broot ***"(set_color normal)
|
||||
echo
|
||||
cargo install broot
|
||||
|
||||
echo
|
||||
echo
|
||||
echo (set_color 719cd6)"*** Install onefetch ***"(set_color normal)
|
||||
echo
|
||||
cargo install onefetch
|
||||
end
|
||||
|
||||
if set -q _flag_desktop && set -q _flag_fix_debian
|
||||
|
@ -166,6 +178,16 @@ function update-homes -d "Update homes configuration"
|
|||
echo (set_color 719cd6)"*** Install pygments style ***"(set_color normal)
|
||||
echo
|
||||
pip install "git+https://procrastinator.nerv-project.eu/kujiu/pygments_nightfox_style" --user --break-system-packages
|
||||
|
||||
echo
|
||||
echo
|
||||
echo (set_color 719cd6)"*** Install xonsh plugins ***"(set_color normal)
|
||||
echo
|
||||
echo "xpip install -U xontrib-commands xontrib-gitinfo \
|
||||
xontrib-broot xontrib-hist-navigator xontrib-prompt-vi-mode \
|
||||
xontrib-vox xontrib-abbrevs xontrib-argcomplete xontrib-django \
|
||||
xonsh-docker-tabcomplete xontrib-fish-completer xontrib-jedi\
|
||||
xontrib-makefile-complete --break-system-packages; exit(1)" | xonsh
|
||||
end
|
||||
|
||||
if set -q _flag_remove
|
||||
|
|
|
@ -15,7 +15,8 @@ lvim.plugins = {
|
|||
{"pirmd/gemini.vim", event="BufRead"},
|
||||
{"dpelle/vim-Grammalecte"},
|
||||
{"vigoux/LanguageTool.nvim"},
|
||||
{"chaimleib/vim-renpy", event="BufRead"}
|
||||
{"chaimleib/vim-renpy", event="BufRead"},
|
||||
{"meatballs/vim-xonsh", event="BufRead"}
|
||||
}
|
||||
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
|
|
@ -23,7 +23,8 @@ require("lazy").setup({
|
|||
{"pirmd/gemini.vim", event="BufRead"},
|
||||
{"dpelle/vim-Grammalecte"},
|
||||
{"vigoux/LanguageTool.nvim"},
|
||||
{"chaimleib/vim-renpy", event="BufRead"}
|
||||
{"chaimleib/vim-renpy", event="BufRead"},
|
||||
{"meatballs/vim-xonsh", event="BufRead"}
|
||||
})
|
||||
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
|
299
common/.config/xonsh/rc.xsh
Executable file
299
common/.config/xonsh/rc.xsh
Executable file
|
@ -0,0 +1,299 @@
|
|||
#!/usr/bin/env xonsh
|
||||
from prompt_toolkit.key_binding.vi_state import InputMode
|
||||
|
||||
$SHELL_TYPE = "prompt_toolkit"
|
||||
$PROMPT_TOOLKIT_COLOR_DEPTH = "DEPTH_24_BIT"
|
||||
|
||||
$NFOX_BLACK = "#393b44"
|
||||
$NFOX_RED = "#c94f6d"
|
||||
$NFOX_GREEN = "#81b29a"
|
||||
$NFOX_YELLOW = "#dbc074"
|
||||
$NFOX_BLUE = "#719cd6"
|
||||
$NFOX_MAGENTA = "#9d79d6"
|
||||
$NFOX_CYAN = "#63cdcf"
|
||||
$NFOX_WHITE = "#dfdfe0"
|
||||
$NFOX_ORANGE = "#f4a261"
|
||||
$NFOX_PINK = "#d67ad2"
|
||||
|
||||
$NFOX_COMMENT = "#738091"
|
||||
|
||||
$NFOX_BG0 = "#131a24"
|
||||
$NFOX_BG1 = "#192330"
|
||||
$NFOX_BG2 = "#212e3f"
|
||||
$NFOX_BG3 = "#29394f"
|
||||
$NFOX_BG4 = "#39506d"
|
||||
|
||||
$NFOX_FG0 = "#d6d6d7"
|
||||
$NFOX_FG1 = "#cdcecf"
|
||||
$NFOX_FG2 = "#aeafb0"
|
||||
$NFOX_FG3 = "#71839b"
|
||||
|
||||
$NFOX_SEL0 = "#2b3b51"
|
||||
$NFOX_SEL1 = "#3c5372"
|
||||
|
||||
# Darker
|
||||
$NFOX_BLACK_D = "#13151e"
|
||||
$NFOX_RED_D = "#a32947"
|
||||
$NFOX_GREEN_D = "#5b8c74"
|
||||
$NFOX_YELLOW_D = "#b59a4e"
|
||||
$NFOX_BLUE_D = "#4b76b0"
|
||||
$NFOX_MAGENTA_D = "#7753b0"
|
||||
$NFOX_CYAN_D = "#3da7a9"
|
||||
$NFOX_WHITE_D = "#b9b9ba"
|
||||
$NFOX_ORANGE_D = "#ce7c3b"
|
||||
$NFOX_PINK_D = "#b054ac"
|
||||
|
||||
#Lighter
|
||||
$NFOX_BLACK_L = "#5F616A"
|
||||
$NFOX_RED_L = "#ef7593"
|
||||
$NFOX_GREEN_L = "#9bccb4"
|
||||
$NFOX_YELLOW_L = "#ffe69a"
|
||||
$NFOX_BLUE_L = "#97c2fc"
|
||||
$NFOX_MAGENTA_L = "#eac6ff"
|
||||
$NFOX_CYAN_L = "#89f3f5"
|
||||
$NFOX_WHITE_L = "#ffffff"
|
||||
$NFOX_ORANGE_L = "#ffc887"
|
||||
$NFOX_PINK_L = "#fca0f8"
|
||||
|
||||
# Load all plugins
|
||||
|
||||
xontrib load commands
|
||||
xontrib load gitinfo
|
||||
xontrib load broot
|
||||
xontrib load hist-navigator
|
||||
xontrib load vox
|
||||
xontrib load autovox
|
||||
xontrib load voxapi
|
||||
xontrib load abbrevs
|
||||
xontrib load argcomplete
|
||||
xontrib load django
|
||||
xontrib load docker_tabcomplete
|
||||
xontrib load fish_completer
|
||||
xontrib load jedi
|
||||
xontrib load makefile_complete
|
||||
|
||||
$VI_MODE = True
|
||||
$XONSH_SHOW_TRACEBACK = True
|
||||
|
||||
$COMPLETIONS_CONFIRM=True
|
||||
|
||||
$DOCKER_BASE_URL = "unix://var/run/docker.sock"
|
||||
|
||||
$VISUAL = "nvim"
|
||||
$EDITOR = "lvim"
|
||||
$PAGER = "nvimpager"
|
||||
$BROWSER = "firefox"
|
||||
$PATH = [
|
||||
p"~/.local/bin",
|
||||
p"~/.cargo/bin",
|
||||
p"~/go/bin",
|
||||
p"/usr/sbin",
|
||||
p"/sbin",
|
||||
p"/usr/local/sbin",
|
||||
p"/usr/local/bin",
|
||||
p"/usr/bin",
|
||||
p"/bin",
|
||||
p"/usr/games"
|
||||
]
|
||||
$NOTMUCH_CONFIG = p"~/.config/notmuch/notmuch-config"
|
||||
$PROJECT_PATHS = [p"~/projects"]
|
||||
|
||||
$KEYRING_PROPERTY_SCHEME = "KeePassXC"
|
||||
|
||||
$XONSH_COLOR_STYLE = 'nightfox_transparent'
|
||||
|
||||
if p"~/.config/xonsh/rc-private.xsh".is_file():
|
||||
source ~/.config/xonsh/rc-private.xsh
|
||||
|
||||
if p"~/.config/xonsh/rc-root.xsh".is_file():
|
||||
source ~/.config/xonsh/rc-root.xsh
|
||||
|
||||
def color_str(fg:str="DEFAULT", bg:str="DEFAULT") -> str:
|
||||
"""
|
||||
Return color string for print_color based on hex values
|
||||
"""
|
||||
return f"{{BACKGROUND_{bg}}}{{{fg}}}"
|
||||
|
||||
def color_to_ansi(color:str):
|
||||
"""
|
||||
Return color string for print_color based on hex values
|
||||
"""
|
||||
color_r = int(color[1:3], 16)
|
||||
color_g = int(color[3:5], 16)
|
||||
color_b = int(color[5:7], 16)
|
||||
return f"2;{color_r};{color_g};{color_b}"
|
||||
|
||||
__PROMPT_VI_MODES = {
|
||||
InputMode.INSERT:
|
||||
color_str($NFOX_BG0, $NFOX_YELLOW) + "I"
|
||||
+ color_str($NFOX_YELLOW) + "",
|
||||
InputMode.INSERT_MULTIPLE:
|
||||
color_str($NFOX_BG0, $NFOX_YELLOW) + "I+"
|
||||
+ color_str($NFOX_YELLOW) + "",
|
||||
InputMode.REPLACE:
|
||||
color_str($NFOX_BG0, $NFOX_BLUE) + "R"
|
||||
+ color_str($NFOX_BLUE) + "",
|
||||
InputMode.REPLACE_SINGLE:
|
||||
color_str($NFOX_BG0, $NFOX_CYAN) + "r"
|
||||
+ color_str($NFOX_CYAN) + "",
|
||||
InputMode.NAVIGATION:
|
||||
color_str($NFOX_BG0, $NFOX_MAGENTA) + "N"
|
||||
+ color_str($NFOX_MAGENTA) + "",
|
||||
}
|
||||
|
||||
def __get_user_prompt():
|
||||
import os
|
||||
user_name = os.getlogin()
|
||||
if "SSH_CLIENT" in ${...}:
|
||||
$IS_REMOTE = True
|
||||
host_color = $NFOX_ORANGE
|
||||
else:
|
||||
$IS_REMOTE = False
|
||||
host_color = $NFOX_BLUE
|
||||
|
||||
if user_name == "root":
|
||||
$IS_ROOT = True
|
||||
user_color = color_str($NFOX_BG0, $NFOX_RED)
|
||||
user_sep = color_str($NFOX_RED, host_color) + ""
|
||||
else:
|
||||
$IS_ROOT = False
|
||||
user_color = color_str($NFOX_BG0, $NFOX_CYAN)
|
||||
user_sep = color_str($NFOX_CYAN, host_color) + ""
|
||||
|
||||
return user_color + user_name + user_sep
|
||||
|
||||
$PROMPT_FIELDS["user"] = __get_user_prompt()
|
||||
|
||||
def __get_host_prompt():
|
||||
import socket
|
||||
if $IS_REMOTE:
|
||||
host_color = color_str($NFOX_BG0, $NFOX_ORANGE)
|
||||
host_sep = color_str($NFOX_ORANGE, $NFOX_FG3) + ""
|
||||
else:
|
||||
host_color = color_str($NFOX_BG0, $NFOX_BLUE)
|
||||
host_sep = color_str($NFOX_BLUE, $NFOX_FG3) + ""
|
||||
return host_color + socket.gethostname().split(".", 1)[0] + host_sep
|
||||
|
||||
$PROMPT_FIELDS["hostname"] = __get_host_prompt()
|
||||
|
||||
if $IS_ROOT:
|
||||
__PROMPT_CWD_COLOR = color_str($NFOX_BG0, $NFOX_RED)
|
||||
__PROMPT_CWD_SEP = color_str($NFOX_RED, $NFOX_BG2) + ""
|
||||
else:
|
||||
__PROMPT_CWD_COLOR = color_str($NFOX_BG0, $NFOX_GREEN)
|
||||
__PROMPT_CWD_SEP = color_str($NFOX_GREEN, $NFOX_BG2) + ""
|
||||
|
||||
def __get_cwd_prompt():
|
||||
from xonsh.prompt.cwd import _dynamically_collapsed_pwd
|
||||
cwd = _dynamically_collapsed_pwd()
|
||||
return __PROMPT_CWD_COLOR + cwd + __PROMPT_CWD_SEP
|
||||
|
||||
$PROMPT_FIELDS["cwd"] = __get_cwd_prompt
|
||||
|
||||
__PROMPT_ENV_COLOR = color_str($NFOX_BG0, $NFOX_FG3)
|
||||
__PROMPT_ENV_SEP = color_str($NFOX_FG3, $NFOX_GREEN) + ""
|
||||
__PROMPT_ENV_SEP_ERROR = color_str($NFOX_FG3, $NFOX_RED) + ""
|
||||
|
||||
def __get_env_prompt():
|
||||
string_venv = ""
|
||||
string_rbenv = ""
|
||||
string_nvm = ""
|
||||
env_result = ""
|
||||
|
||||
string_rbenv = str(!(rbenv local err> /dev/null))
|
||||
if not string_rbenv:
|
||||
string_rbenv = str(!(rbenv global err> /dev/null))
|
||||
string_rbenv = string_rbenv.replace('\n', '')
|
||||
if string_rbenv == "system":
|
||||
string_rbenv = ""
|
||||
|
||||
if "nvm_current_version" in ${...}:
|
||||
string_nvm = $nvm_current_version
|
||||
|
||||
if "VIRTUAL_ENV" in ${...}:
|
||||
string_venv = $VIRTUAL_ENV.split('/')[-1]
|
||||
|
||||
if string_nvm or string_rbenv or string_venv:
|
||||
env_result = f" {string_nvm}| {string_rbenv}| {string_venv}"
|
||||
|
||||
if $LAST_RETURN_CODE == 0:
|
||||
return __PROMPT_ENV_COLOR + env_result + __PROMPT_ENV_SEP
|
||||
|
||||
return __PROMPT_ENV_COLOR + env_result + __PROMPT_ENV_SEP_ERROR
|
||||
|
||||
$PROMPT_FIELDS["env_name"] = __get_env_prompt
|
||||
|
||||
__PROMPT_LAST_STATE_SUCCESS = color_str($NFOX_BG0, $NFOX_GREEN) + "xonsh✔" \
|
||||
+ color_str($NFOX_GREEN) + ""
|
||||
__PROMPT_LAST_STATE_ERROR = color_str($NFOX_BG0, $NFOX_RED) + "xonsh✗"
|
||||
__PROMPT_LAST_STATE_ERROR_SUFFIX = color_str($NFOX_RED) + ""
|
||||
|
||||
def __get_last_state_prompt():
|
||||
if $LAST_RETURN_CODE == 0:
|
||||
return __PROMPT_LAST_STATE_SUCCESS
|
||||
return __PROMPT_LAST_STATE_ERROR + str($LAST_RETURN_CODE) \
|
||||
+ __PROMPT_LAST_STATE_ERROR_SUFFIX
|
||||
|
||||
$PROMPT_FIELDS["last_state"] = __get_last_state_prompt
|
||||
|
||||
$PROMPT_FIELDS["vi_mode"] = lambda: __PROMPT_VI_MODES.get(
|
||||
__xonsh__.shell.shell.prompter.app.vi_state.input_mode,
|
||||
color_str($NFOX_BG0, $NFOX_GREEN) + "E"
|
||||
+ color_str($NFOX_GREEN) + ""
|
||||
)
|
||||
|
||||
$PROMPT_FIELDS['gitstatus.branch'].prefix = color_str($NFOX_ORANGE, $NFOX_BG2) + ""
|
||||
$PROMPT_FIELDS['gitstatus.conflicts'].prefix = color_str($NFOX_RED, $NFOX_BG2) + "x"
|
||||
$PROMPT_FIELDS['gitstatus.operations'].prefix = color_str($NFOX_ORANGE, $NFOX_BG2) + ""
|
||||
$PROMPT_FIELDS['gitstatus.changed'].prefix = color_str($NFOX_GREEN, $NFOX_BG2) + "-"
|
||||
$PROMPT_FIELDS['gitstatus.deleted'].prefix = color_str($NFOX_RED, $NFOX_BG2) + "+"
|
||||
$PROMPT_FIELDS['gitstatus.staged'].prefix = color_str($NFOX_BLUE, $NFOX_BG2) + "●"
|
||||
$PROMPT_FIELDS['gitstatus.lines_added'].prefix = color_str($NFOX_GREEN, $NFOX_BG2) + "+"
|
||||
$PROMPT_FIELDS['gitstatus.lines_removed'].prefix = color_str($NFOX_RED, $NFOX_BG2) + "-"
|
||||
$PROMPT_FIELDS['gitstatus.clean'].prefix = color_str($NFOX_BLUE, $NFOX_BG2) + "C"
|
||||
$PROMPT_FIELDS['gitstatus_sep'] = color_str($NFOX_BG2) + "\n"
|
||||
|
||||
$PROMPT_FIELDS['gitstatus.ahead'].prefix = color_str($NFOX_ORANGE, $NFOX_BG2) + "↑·"
|
||||
$PROMPT_FIELDS['gitstatus.behind'].prefix = color_str($NFOX_ORANGE, $NFOX_BG2) + "↓·"
|
||||
$PROMPT_FIELDS['gitstatus.numstat'].prefix = color_str($NFOX_BLUE, $NFOX_BG2) + "N"
|
||||
$PROMPT_FIELDS['gitstatus.porcelain'].prefix = color_str($NFOX_ORANGE, $NFOX_BG2) + "p"
|
||||
$PROMPT_FIELDS['gitstatus.repo_path'].prefix = color_str($NFOX_GREEN, $NFOX_BG2) + "P"
|
||||
$PROMPT_FIELDS['gitstatus.short_head'].prefix = color_str($NFOX_PINK, $NFOX_BG2) + "h"
|
||||
$PROMPT_FIELDS['gitstatus.stash_count'].prefix = color_str($NFOX_YELLOW, $NFOX_BG2) + "S"
|
||||
$PROMPT_FIELDS['gitstatus.tag'].prefix = color_str($NFOX_BLUE, $NFOX_BG2) + "T"
|
||||
$PROMPT_FIELDS['gitstatus.tag_or_hash'].prefix = color_str($NFOX_CYAN, $NFOX_BG2) + "T"
|
||||
$PROMPT_FIELDS['gitstatus.untracked'].prefix = color_str($NFOX_YELLOW, $NFOX_BG2) + "…"
|
||||
$VC_GIT_INCLUDE_UNTRACKED = True
|
||||
|
||||
$UPDATE_OS_ENVIRON = True
|
||||
$UPDATE_PROMPT_ON_KEYPRESS = True
|
||||
$PROMPT_REFRESH_INTERVAL = 1
|
||||
$PROMPT = "{user}{hostname}{env_name}{last_state}\n{cwd}{gitstatus}{gitstatus_sep}{vi_mode}"
|
||||
$MULTILINE_PROMPT = color_str($NFOX_YELLOW) + "█"
|
||||
#$ENABLE_ASYNC_PROMPT = True
|
||||
|
||||
$INDENT = " "
|
||||
$XONSH_STDERR_PREFIX = color_str($NFOX_RED) + "ERR:"
|
||||
$XONSH_STDERR_POSTFIX = "{RESET}"
|
||||
|
||||
$AUTO_SUGGEST_IN_COMPLETIONS = True
|
||||
$CMD_COMPLETIONS_SHOW_DESC = True
|
||||
$COMPLETIONS_DISPLAY = "multi"
|
||||
$COMPLETION_IN_THREAD = True
|
||||
$CASE_SENSITIVE_COMPLETIONS = False
|
||||
$MOUSE_SUPPORT = True
|
||||
$XONSH_AUTOPAIR = True
|
||||
|
||||
$LS_COLORS = "*.7z=1;0;31:*.Z=1;0;31:*.aac=0;36:*.ace=1;0;31:*.alz=1;0;31:*.arc=1;0;31:*.arj=1;0;31:*.asf=1;0;35:*.au=0;36:*.avi=1;0;35:*.bmp=1;0;35:*.bz=1;0;31:*.bz2=1;0;31:*.cab=1;0;31:*.cgm=1;0;35:*.cpio=1;0;31:*.deb=1;0;31:*.dl=1;0;35:*.dwm=1;0;31:*.dz=1;0;31:*.ear=1;0;31:*.emf=1;0;35:*.esd=1;0;31:*.flac=0;36:*.flc=1;0;35:*.fli=1;0;35:*.flv=1;0;35:*.gif=1;0;35:*.gl=1;0;35:*.gz=1;0;31:*.jar=1;0;31:*.jpeg=1;0;35:*.jpg=1;0;35:*.lha=1;0;31:*.lrz=1;0;31:*.lz=1;0;31:*.lz4=1;0;31:*.lzh=1;0;31:*.lzma=1;0;31:*.lzo=1;0;31:*.m2v=1;0;35:*.m4a=0;36:*.m4v=1;0;35:*.mid=0;36:*.midi=0;36:*.mjpeg=1;0;35:*.mjpg=1;0;35:*.mka=0;36:*.mkv=1;0;35:*.mng=1;0;35:*.mov=1;0;35:*.mp3=0;36:*.mp4=1;0;35:*.mp4v=1;0;35:*.mpc=0;36:*.mpeg=1;0;35:*.mpg=1;0;35:*.nuv=1;0;35:*.oga=0;36:*.ogg=0;36:*.ogm=1;0;35:*.ogv=1;0;35:*.ogx=1;0;35:*.opus=0;36:*.pbm=1;0;35:*.pcx=1;0;35:*.pgm=1;0;35:*.png=1;0;35:*.ppm=1;0;35:*.qt=1;0;35:*.ra=0;36:*.rar=1;0;31:*.rm=1;0;35:*.rmvb=1;0;35:*.rpm=1;0;31:*.rz=1;0;31:*.sar=1;0;31:*.spx=0;36:*.svg=1;0;35:*.svgz=1;0;35:*.swm=1;0;31:*.t7z=1;0;31:*.tar=1;0;31:*.taz=1;0;31:*.tbz=1;0;31:*.tbz2=1;0;31:*.tga=1;0;35:*.tgz=1;0;31:*.tif=1;0;35:*.tiff=1;0;35:*.tlz=1;0;31:*.txz=1;0;31:*.tz=1;0;31:*.tzo=1;0;31:*.tzst=1;0;31:*.vob=1;0;35:*.war=1;0;31:*.wav=0;36:*.webm=1;0;35:*.wim=1;0;31:*.wmv=1;0;35:*.xbm=1;0;35:*.xcf=1;0;35:*.xpm=1;0;35:*.xspf=0;36:*.xwd=1;0;35:*.xz=1;0;31:*.yuv=1;0;35:*.z=1;0;31:*.zip=1;0;31:*.zoo=1;0;31:*.zst=1;0;31:bd=40;0;33:ca=0;30;41:cd=40;0;33:di=1;0;34:do=1;0;35:ex=1;0;32:ln=1;0;36:mh=0:mi=0:or=40;0;31:ow=0;34;42:pi=40;0;33:rs=0:sg=0;30;43:so=1;0;35:st=0;37;44:su=0;37;41:tw=0;30;42"
|
||||
|
||||
pushd "~/.config/xonsh"
|
||||
import rc_private
|
||||
import rc_desktop
|
||||
|
||||
if $IS_ROOT:
|
||||
import rc_root
|
||||
|
||||
import rc_common_aliases
|
||||
popd
|
||||
|
||||
json-fortune
|
107
common/.config/xonsh/rc_common_aliases.xsh
Executable file
107
common/.config/xonsh/rc_common_aliases.xsh
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env xonsh
|
||||
|
||||
aliases["diff"] = "colordiff"
|
||||
aliases["gitci"] = "git commit -S"
|
||||
aliases["gitcia"] = "git commit -Sa"
|
||||
aliases["gitco"] = "git checkout"
|
||||
aliases["gitdiff"] = "git diff"
|
||||
aliases["gitgrep"] = "git grep"
|
||||
aliases["gitlog"] = "git log --name-status"
|
||||
aliases["gitlstags"] = "git describe --tags"
|
||||
aliases["gittag"] = "git tag -a"
|
||||
aliases["gittree"] = "git log --graph"
|
||||
aliases["gitw"] = "git instaweb --httpd=webrick"
|
||||
aliases["l"] = "ls --color -pa"
|
||||
aliases["less"] = "nvimpager"
|
||||
aliases["lg"] = "lazygit"
|
||||
aliases["ll"] = "ls --color -pla"
|
||||
aliases["ls"] = "ls --color -p"
|
||||
aliases["lzd"] = "lazydocker"
|
||||
aliases["make"] = "colormake"
|
||||
aliases["mbsync"] = "mbsync -c ~/.config/mbsync/mbsyncrc"
|
||||
aliases["more"] = "nvimpager"
|
||||
aliases["tig"] = "TERM=tmux-256color tig"
|
||||
aliases["txor"] = "tmuxinator"
|
||||
aliases["vim"] = "lvim -p"
|
||||
aliases["vimdiff"] = "lvim -d -o"
|
||||
|
||||
def _gitgrephistory(args):
|
||||
if len(args) == 1:
|
||||
git rev-list --all | xargs git grep @(args[1])
|
||||
else:
|
||||
git rev-list --all | sed 's!$!:'@('"' + args[0] + '"')'!' | xargs git grep @(' '.join(args[1:]))
|
||||
|
||||
aliases["gitgrephistory"] = _gitgrephistory
|
||||
|
||||
def _gitpr(args):
|
||||
"""git pull rebase and update modules"""
|
||||
git pull --stat --progress --rebase @(' '.join(args))
|
||||
git submodule update
|
||||
|
||||
aliases["gitpr"] = _gitpr
|
||||
|
||||
def _gitprp(args):
|
||||
"""
|
||||
git pull, rebase, update modules and push
|
||||
"""
|
||||
git pull --stat --progress --rebase @(' '.join(args))
|
||||
git submodule update
|
||||
git push
|
||||
|
||||
aliases["gitprp"] = _gitprp
|
||||
|
||||
def _gitprst(args):
|
||||
"""
|
||||
git stash, pull, rebase, update modules and apply stash
|
||||
"""
|
||||
git stash
|
||||
git pull --stat --progress --rebase @(' '.join(args))
|
||||
git submodule update
|
||||
git stash apply
|
||||
|
||||
aliases["gitprst"] = _gitprst
|
||||
|
||||
def _gitprstp(args):
|
||||
"""
|
||||
git stash, pull, rebase, update modules, apply stash and push
|
||||
"""
|
||||
git stash
|
||||
git pull --stat --progress --rebase @(' '.join(args))
|
||||
git submodule update
|
||||
git stash apply
|
||||
git push
|
||||
|
||||
aliases["gitprstp"] = _gitprstp
|
||||
|
||||
def _gitpull(args):
|
||||
"""
|
||||
git pull and update submodules
|
||||
"""
|
||||
git pull --stat --progress @(' '.join(args))
|
||||
git submodule update
|
||||
|
||||
aliases["gitpull"] = _gitpull
|
||||
|
||||
def _gitst(args):
|
||||
"""
|
||||
git status
|
||||
"""
|
||||
git status @(' '.join(args)) | nvimpager
|
||||
|
||||
aliases["gitst"] = _gitst
|
||||
|
||||
def _pip_upgrade(args):
|
||||
"""
|
||||
Upgrade python user-installed packaged
|
||||
"""
|
||||
pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U --user @(' '.join(args))
|
||||
|
||||
aliases["pip_upgrade"] = _pip_upgrade
|
||||
|
||||
def _pip_upgrade_venv(args):
|
||||
"""
|
||||
Upgrade virtualenv
|
||||
"""
|
||||
pip freeze | cut -d'=' -f1 | xargs -n1 pip install -U @(' '.join(args))
|
||||
|
||||
aliases["pip_upgrade_venv"] = _pip_upgrade_venv
|
|
@ -1,65 +1,7 @@
|
|||
# Configuration file for ipython.
|
||||
|
||||
from IPython.terminal.prompts import Prompts, RichPromptDisplayHook
|
||||
from pygments.token import Token
|
||||
from prompt_toolkit.enums import EditingMode
|
||||
from platform import python_version
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
import pygments_nightfox_style
|
||||
|
||||
class NightfoxPrompts(Prompts):
|
||||
def vi_mode(self):
|
||||
if (getattr(self.shell.pt_app, 'editing_mode', None) == EditingMode.VI
|
||||
and self.shell.prompt_includes_vi_mode):
|
||||
mode = str(self.shell.pt_app.app.vi_state.input_mode)
|
||||
if "INSERT" in mode:
|
||||
return 'I'
|
||||
if "NAV" in mode:
|
||||
return 'N'
|
||||
if "REPLACE_SINGLE" in mode:
|
||||
return 'r'
|
||||
if "REPLACE" in mode:
|
||||
return ''
|
||||
return 'E' # Emacs mode
|
||||
|
||||
def in_prompt_tokens(self):
|
||||
git_branch = ""
|
||||
try:
|
||||
git_branch = subprocess.check_output(
|
||||
["git", "branch", "--show-current"], stderr=subprocess.DEVNULL
|
||||
)
|
||||
if git_branch:
|
||||
git_branch = git_branch.decode("utf-8").replace("\n", "")
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
git_branch = str(git_branch)
|
||||
|
||||
venv = (os.environ.get("VIRTUAL_ENV") or "").split("/")[-1]
|
||||
|
||||
return [
|
||||
(Token.IPython.Prompt.Login, os.getlogin()),
|
||||
(Token.IPython.Prompt.Login.Sep, ''),
|
||||
(Token.IPython.Prompt.Host, socket.gethostname()),
|
||||
(Token.IPython.Prompt.Host.Sep, ''),
|
||||
(Token.IPython.Prompt.Venv, venv),
|
||||
(Token.IPython.Prompt.Venv.Sep, ''),
|
||||
(Token.IPython.Prompt.Version, ' ' + python_version()),
|
||||
(Token.IPython.Prompt.Version.Sep, ''),
|
||||
(Token, '\n'),
|
||||
(Token.IPython.Prompt.Cwd, os.getcwd()),
|
||||
(Token.IPython.Prompt.Cwd.Sep, ''),
|
||||
(Token.IPython.Prompt.Vcs, str(' ') + git_branch if git_branch else ''),
|
||||
(Token.IPython.Prompt.Vcs.Sep, ''),
|
||||
(Token, '\n'),
|
||||
(Token.IPython.Prompt.Mode, self.vi_mode()),
|
||||
(Token.IPython.Prompt.Mode.Sep, ' '),
|
||||
]
|
||||
|
||||
def out_prompt_tokens(self):
|
||||
return []
|
||||
from pygments_nightfox_style.ipython_prompt import NightfoxPrompts
|
||||
|
||||
c = get_config() # noqa
|
||||
|
||||
|
@ -724,7 +666,7 @@ c.TerminalInteractiveShell.editor = 'lvim'
|
|||
## The name or class of a Pygments style to use for syntax
|
||||
# highlighting. To see available styles, run `pygmentize -L styles`.
|
||||
# Default: traitlets.Undefined
|
||||
c.TerminalInteractiveShell.highlighting_style = pygments_nightfox_style.NightfoxStyle
|
||||
c.TerminalInteractiveShell.highlighting_style = pygments_nightfox_style.NightfoxTransparentStyle
|
||||
|
||||
## Override highlighting format for specific tokens
|
||||
# Default: {}
|
||||
|
|
|
@ -445,7 +445,7 @@ address-book-cmd=khard email --parsable --remove-first-line %s
|
|||
# accepted. The commands are invoked with sh -c and are expected to output
|
||||
# valid UTF-8 text.
|
||||
#
|
||||
text/html=elinks -dump 1 | pygmentize -l rst -O style=nightfox_transparent | colorize
|
||||
text/html=pandoc -f html -t rst --list-tables=true | pygmentize -l rst -O style=nightfox_transparent | colorize
|
||||
|
||||
[filters]
|
||||
#
|
||||
|
@ -479,7 +479,8 @@ text/plain=colorize
|
|||
text/calendar=calendar
|
||||
message/delivery-status=colorize
|
||||
message/rfc822=colorize
|
||||
text/html=elinks -dump 1 | colorize
|
||||
#text/html=elinks -dump 1 | colorize
|
||||
text/html=pandoc -f html -t rst --list-tables=true | pygmentize -l rst -O style=nightfox_transparent | colorize
|
||||
#text/html=html | colorize
|
||||
#text/*=bat -fP --file-name="$AERC_FILENAME"
|
||||
#application/x-sh=bat -fP -l sh
|
||||
|
|
20
desktop/.config/xonsh/rc_desktop.xsh
Executable file
20
desktop/.config/xonsh/rc_desktop.xsh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env xonsh
|
||||
#
|
||||
aliases["aerc"] = "TERM=xterm-direct command aerc"
|
||||
aliases["newsboat"] = "TERM=tmux-256color newsboat"
|
||||
aliases["pms"] = "TERM=xterm-direct pms"
|
||||
aliases["poezio"] = "TERM=tmux-256color poezio"
|
||||
aliases["tsumugi"] = "mpv https://azuracast.mahoro-net.org/listen/tsumugi/radio.mp3"
|
||||
|
||||
def _mpc(args):
|
||||
mpc -f "%title%[ -%album%]\n\r%artist%[ - %performer%]\n\r%file%" @(" ".join(args))
|
||||
|
||||
aliases["mpc"] = _mpc
|
||||
|
||||
def _android_cast(args):
|
||||
"""
|
||||
Cast Android screen
|
||||
"""
|
||||
adb shell "while true; do screenrecord --output-format=h264 -; done" | ffplay -framerate 60 -probesize 32 -sync video -
|
||||
|
||||
aliases["android_cast"] = _android_cast
|
|
@ -45,7 +45,7 @@ NFOX_SEL1_BG = "\033[48;2;60;83;114m"
|
|||
|
||||
NO_COLOR = "\033[39m\033[49m\033[00m"
|
||||
NO_BG = "\033[49m"
|
||||
NO_FG = "\033[49m"
|
||||
NO_FG = "\033[39m"
|
||||
BOLD = "\033[01m"
|
||||
ITALIC = "\033[03m"
|
||||
UNDERLINE = "\033[04m"
|
||||
|
|
0
root/.config/xonsh/rc_root.xsh
Executable file
0
root/.config/xonsh/rc_root.xsh
Executable file
0
templates/.config/xonsh/rc_private.xsh
Normal file
0
templates/.config/xonsh/rc_private.xsh
Normal file
|
@ -1,24 +0,0 @@
|
|||
function __fish_tmuxinator_using_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 1 ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
set __fish_tmuxinator_program_cmd (commandline -o)[1]
|
||||
|
||||
function __fish_tmuxinator_program
|
||||
eval "$__fish_tmuxinator_program_cmd $argv"
|
||||
end
|
||||
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -a '(__fish_tmuxinator_program completions start)'
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_use_subcommand' -x -a "(__fish_tmuxinator_program commands)"
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command start' -a "(__fish_tmuxinator_program completions start)"
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command open' -a "(__fish_tmuxinator_program completions open)"
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command copy' -a "(__fish_tmuxinator_program completions copy)"
|
||||
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command delete' -a "(__fish_tmuxinator_program completions delete)"
|
||||
|
||||
abbr --add mux "tmuxinator"
|
Loading…
Reference in a new issue