mirror of https://git.decapod.one/brethil/dotfiles
Compare commits
6 Commits
37f33a3614
...
b73838f58b
Author | SHA1 | Date |
---|---|---|
bretello | b73838f58b | |
bretello | 58393456a9 | |
bretello | 353378af8c | |
bretello | 439f29318c | |
bretello | f9e4a2c224 | |
bretello | b5ebe15e79 |
|
@ -12,8 +12,6 @@
|
||||||
shell: |
|
shell: |
|
||||||
chgrp nobody /home/build
|
chgrp nobody /home/build
|
||||||
chmod g+ws /home/build
|
chmod g+ws /home/build
|
||||||
setfacl -m u::rwx,g::rwx /home/build
|
|
||||||
setfacl -d --set u::rwx,g::rwx,o::- /home/build
|
|
||||||
when:
|
when:
|
||||||
- build_dir is defined
|
- build_dir is defined
|
||||||
|
|
||||||
|
@ -47,5 +45,5 @@
|
||||||
- name: Install yay
|
- name: Install yay
|
||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
name:
|
name:
|
||||||
- /home/build/yay/yay-*.tar.xz
|
- /home/build/yay/yay-*.tar.zst
|
||||||
state: present
|
state: present
|
||||||
|
|
|
@ -34,7 +34,7 @@ elif [[ "$(command -v apt-get)" ]]; then
|
||||||
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
|
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=gray,bg=white,bold'
|
ZSH_HIGHLIGHT_STYLES[comment]='fg=white,bg=gray,bold'
|
||||||
|
|
||||||
# Setup oh-my-zsh path
|
# Setup oh-my-zsh path
|
||||||
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
||||||
|
@ -78,6 +78,7 @@ export SAVEHIST=10000000
|
||||||
|
|
||||||
# zsh-autosuggestions config
|
# zsh-autosuggestions config
|
||||||
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||||
|
export ZSH_AUTOSUGGEST_COMPLETION_IGNORE='* \#*' # prevent completion for comments
|
||||||
|
|
||||||
# less options
|
# less options
|
||||||
export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ?
|
export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ?
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# ansi colors are pretty simple. In 256 color mode, for a given
|
||||||
|
# (r, g, b) tuple:
|
||||||
|
# \x1b[38;2;r;g;bm - foreground
|
||||||
|
# \x1b[48;2;r;g;bm - background
|
||||||
|
|
||||||
|
|
||||||
# ANSI COLOR ESCAPES
|
# ANSI COLOR ESCAPES
|
||||||
# CLEAR
|
# CLEAR
|
||||||
CLEAR='\e[0m' # CLEAR
|
CLEAR='\e[0m' # CLEAR
|
||||||
|
|
|
@ -72,6 +72,10 @@ function blue
|
||||||
{
|
{
|
||||||
echo -e "$Blue$@$CLEAR"
|
echo -e "$Blue$@$CLEAR"
|
||||||
}
|
}
|
||||||
|
function bold
|
||||||
|
{
|
||||||
|
echo -e "$BOLD$@$CLEAR"
|
||||||
|
}
|
||||||
|
|
||||||
## Flashes the screen until user presses a key
|
## Flashes the screen until user presses a key
|
||||||
function flasher
|
function flasher
|
||||||
|
|
11
pdbrc.py
11
pdbrc.py
|
@ -11,16 +11,9 @@ else:
|
||||||
|
|
||||||
class Config(pdb.DefaultConfig):
|
class Config(pdb.DefaultConfig):
|
||||||
# prompt = "(Pdb++) "
|
# prompt = "(Pdb++) "
|
||||||
skip = ["dvc.stage.decorators.*", "funcy.*"]
|
|
||||||
sticky_by_default = True
|
|
||||||
use_pygments = True
|
use_pygments = True
|
||||||
if pdb.__version__.version.startswith("0.10.4."):
|
pygments_formatter_class = "pygments.formatters.TerminalTrueColorFormatter"
|
||||||
pygments_formatter_class = "pygments.formatters.TerminalTrueColorFormatter"
|
pygments_formatter_kwargs = {"style": get_style_by_name(pygments_style)}
|
||||||
pygments_formatter_kwargs = {"style": get_style_by_name(pygments_style)}
|
|
||||||
else:
|
|
||||||
from pygments.formatters import TerminalTrueColorFormatter
|
|
||||||
|
|
||||||
formatter = TerminalTrueColorFormatter(style=get_style_by_name(pygments_style))
|
|
||||||
|
|
||||||
editor = "vim"
|
editor = "vim"
|
||||||
|
|
||||||
|
|
|
@ -1,58 +1,40 @@
|
||||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||||
# color chart available at https://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
# brethil oh-my-zsh theme
|
||||||
# %F{202}: orange
|
# See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc`
|
||||||
# %K{202}: background orange
|
# Note: Most of the expansions/color sequences can be tested using `print -P`
|
||||||
# 255: white
|
|
||||||
# See the prompt expansion section in `info zsh` for more info
|
|
||||||
|
|
||||||
function user_prompt(){
|
function user_prompt(){
|
||||||
# prints info about username/hostname
|
# prints hostname on an orange background if on an ssh connection, adds username if root
|
||||||
# for ssh connections
|
|
||||||
local p
|
local user='%(!.%K{160}%F{255}%B%n%b%k%f.)' # prints 'root' on a red background if user is root
|
||||||
local host
|
local host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background
|
||||||
if [[ $UID -eq 0 ]]; then
|
local open_bracket='%(!.[.)'
|
||||||
# root
|
local close_bracket='%(!.].)'
|
||||||
echo -n "%F{255}[%f" # open square bracket
|
local at='%(!.@.)'
|
||||||
echo -n "%K{160}%F{255}%Broot%b%k%f"
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
if [[ $SSH_CONNECTION ]]; then
|
echo "${open_bracket}${user}${at}${host}${close_bracket}"
|
||||||
# add the white @
|
else
|
||||||
# echo -n '%F{255} at %f'
|
echo "${open_bracket}${user}${close_bracket}"
|
||||||
echo -n "%F{255}@%f"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ $SSH_CONNECTION ]]; then
|
|
||||||
if [[ $UID -ne 0 ]]; then
|
|
||||||
echo -n "%F{255}[%f" # open square bracket
|
|
||||||
fi
|
|
||||||
# underlined orange hostname (%m)
|
|
||||||
echo -n "%K{202}%B%F{255}%m%f%k%b"
|
|
||||||
if [[ $UID -ne 0 ]]; then
|
|
||||||
echo -n "%F{255}]%f" # close square bracket
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# close square bracket
|
|
||||||
if [[ $UID -eq 0 ]]; then echo "%F{255}]%f"; fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function job_prompt() {
|
function job_prompt() {
|
||||||
local JOB_PROMPT="%(1j.%B%K{202}%F{220} %j %k%b.)" # Shows jobs number on an orange background if there are background jobs
|
# Shows jobs number on an orange background if there are background jobs
|
||||||
echo "$JOB_PROMPT"
|
echo "%(1j.%B%K{202}%F{220} %j %k%b.)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function shlvl_prompt() {
|
function shlvl_prompt() {
|
||||||
local SHLVL_PROMPT
|
# Shows SHLVL on a magenta background if SHLVL > 1 (2 if in a tmux session)
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -z "$TMUX" ]]; then
|
||||||
SHLVL_PROMPT="%(3L.%K{161}%F{255}%B $((SHLVL-1)) %f%b%k.)" # Shows SHLVL on a magenta background if SHLVL > 1
|
echo "%(2L.%K{161}%F{255}%B %L %f%b%k.)"
|
||||||
else
|
else
|
||||||
SHLVL_PROMPT="%(2L.%K{161}%F{255}%B %L %f%b%k.)" # Shows SHLVL on a magenta background if SHLVL > 1
|
echo "%(3L.%K{161}%F{255}%B $((SHLVL-1)) %f%b%k.)"
|
||||||
fi
|
fi
|
||||||
echo "$SHLVL_PROMPT"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function path_prompt(){
|
function path_prompt(){
|
||||||
# Shows last 3 items in path if there are more than 4
|
# Shows last 3 items in path if there are more than 4
|
||||||
local PATH_PROMPT="%F{white}[%F{green}%(4~:…/%3~:%~)%F{white}]%f"
|
echo "[%F{green}%(4~:…/%3~:%~)%f]"
|
||||||
echo "$PATH_PROMPT"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# PREFIX/SUFFIX are added before/after `git_prompt_info`
|
# PREFIX/SUFFIX are added before/after `git_prompt_info`
|
||||||
|
@ -75,9 +57,9 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%B%F{red}?%b%f" # red
|
||||||
|
|
||||||
# The following are part of `git_remote_status`
|
# The following are part of `git_remote_status`
|
||||||
# ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="%{$fg[green]%}="
|
# ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="%{$fg[green]%}="
|
||||||
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%F{255}>%f"
|
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
|
||||||
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%F{255}<%f"
|
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
|
||||||
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%F{255}<>%f"
|
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
|
||||||
|
|
||||||
function virtualenv_info {
|
function virtualenv_info {
|
||||||
[ -z "$VIRTUAL_ENV" ] && return
|
[ -z "$VIRTUAL_ENV" ] && return
|
||||||
|
@ -90,70 +72,42 @@ function virtualenv_info {
|
||||||
venv="$(basename $(dirname "$VIRTUAL_ENV") )"
|
venv="$(basename $(dirname "$VIRTUAL_ENV") )"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "$BOLD_PURPLE"
|
echo -n " $BOLD_PURPLE<$venv>$CLEAR "
|
||||||
echo -n " <$venv> "
|
|
||||||
echo -n "$CLEAR"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt() {
|
function git_prompt() {
|
||||||
if [[ -n "$(git status 2>/dev/null)" ]]; then
|
# prints git info if in a git repo
|
||||||
local GIT_PROMPT=" %F{255}$(git_prompt_info)%B%F{255} |%f%b$(git_prompt_status)$(git_remote_status)"
|
if ! git rev-parse --git-dir &>/dev/null; then
|
||||||
echo "$GIT_PROMPT"
|
return
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo " $(git_prompt_info) |$(git_prompt_status)$(git_remote_status)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_last_exit_code() {
|
|
||||||
local LAST_EXIT_CODE=$?
|
|
||||||
if [[ $LAST_EXIT_CODE -ne 0 ]]; then
|
|
||||||
local EXIT_CODE_PROMPT
|
|
||||||
EXIT_CODE_PROMPT+="%B%F{88}-$LAST_EXIT_CODE-%f%b"
|
|
||||||
echo "$EXIT_CODE_PROMPT"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function return_code_RPS1() {
|
function return_code_RPS1() {
|
||||||
# For right-side prompt
|
# red status code if last exit code is non-zero
|
||||||
local return_code="%(?..$(check_last_exit_code))" # for RPS1
|
echo "%(?..%B%F{88}-$?-%f%b)"
|
||||||
echo "$return_code"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ret_status() {
|
function prompt_with_previous_return_status() {
|
||||||
local ret_status="%(?:%B%F{28} →%f%b:%{$fg[red]%} x%{$reset_color%})"
|
local success="%B%F{28} →%f%b"
|
||||||
echo "$ret_status"
|
local failure="%B%{$fg[red]%} x%b%{$reset_color%}"
|
||||||
|
echo "%(?:$success:$failure)"
|
||||||
}
|
}
|
||||||
|
|
||||||
export MODE_INDICATOR="[%B%K{88}nav%k%b]"
|
|
||||||
export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]"
|
|
||||||
|
|
||||||
_PROMPT_PROTO='$(virtualenv_info)$(user_prompt)$(path_prompt)$(git_prompt)$(job_prompt)$(shlvl_prompt)'
|
|
||||||
|
|
||||||
function prompt_too_long(){
|
function prompt_too_long(){
|
||||||
local zero='%([BSUbfksu]|([FK]|){*})'
|
# prints a newline if more than $COLUMNS/2 characters have been printed
|
||||||
if [[ -x $commands[gsed] ]]; then # fuck darwin
|
local newline=$'\n'
|
||||||
sed='gsed'
|
echo "%-$((COLUMNS/2))(l..${newline})"
|
||||||
elif [[ "$(uname)" == "Darwin" ]]; then
|
|
||||||
local msg="error: multi-line prompt requires GNU sed"
|
|
||||||
msg+="install with \"brew install gnu-sed\""
|
|
||||||
echo "$msg"
|
|
||||||
return
|
|
||||||
else
|
|
||||||
sed='sed'
|
|
||||||
fi
|
|
||||||
|
|
||||||
local stripped="$(echo ${(S%%)_PROMPT_PROTO//$~zero/} | $sed 's|\x1B\[[0-9;]*[a-zA-Z]||g')"
|
|
||||||
local prompt_len=${#stripped}
|
|
||||||
local max_len=$(($COLUMNS/2))
|
|
||||||
if [[ $prompt_len -ge $max_len ]]; then
|
|
||||||
echo true
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT="$(echo "$_PROMPT_PROTO")"
|
## oh-my-zsh vi-mode plugins indicators:
|
||||||
NEWLINE=$'\n'
|
export MODE_INDICATOR="[%B%K{red}nav%k%b]" # red background
|
||||||
PROMPT+='${$(prompt_too_long)/true/${NEWLINE}}'
|
export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background
|
||||||
PROMPT+='$(ret_status) '
|
|
||||||
|
PROMPT='$(virtualenv_info)$(user_prompt)$(path_prompt)$(git_prompt)$(job_prompt)$(shlvl_prompt)$(prompt_too_long)$(prompt_with_previous_return_status) '
|
||||||
|
|
||||||
# Right prompt is just return code and time
|
# Right prompt is just return code and time
|
||||||
RPS1='$(return_code_RPS1)$(vi_mode_prompt_info)%F{255}[%*]%f'
|
RPS1='$(return_code_RPS1)$(vi_mode_prompt_info)[%*]'
|
||||||
|
|
Loading…
Reference in New Issue