terminal tool colours
This commit is contained in:
@@ -29,13 +29,18 @@
|
|||||||
line-numbers = true
|
line-numbers = true
|
||||||
paging = always
|
paging = always
|
||||||
pager = less --mouse -R -+X -+F
|
pager = less --mouse -R -+X -+F
|
||||||
|
syntax-theme = dots
|
||||||
file-decoration-style = none
|
file-decoration-style = none
|
||||||
file-style = "#2CB494" bold
|
file-style = "#2CB494" bold
|
||||||
hunk-header-decoration-style = none
|
hunk-header-decoration-style = none
|
||||||
line-numbers-left-style = "#2CB494"
|
line-numbers-left-style = "#808080"
|
||||||
line-numbers-right-style = "#2CB494"
|
line-numbers-right-style = "#808080"
|
||||||
|
line-numbers-minus-style = "#F40404"
|
||||||
|
line-numbers-plus-style = "#2CB494"
|
||||||
plus-style = syntax "#0c2a24"
|
plus-style = syntax "#0c2a24"
|
||||||
plus-emph-style = syntax "#164a3c"
|
plus-emph-style = syntax "#164a3c"
|
||||||
|
minus-style = syntax "#2a0a0a"
|
||||||
|
minus-emph-style = syntax "#3a1a1a"
|
||||||
|
|
||||||
[merge]
|
[merge]
|
||||||
conflictstyle = zdiff3
|
conflictstyle = zdiff3
|
||||||
@@ -44,31 +49,35 @@
|
|||||||
ui = auto
|
ui = auto
|
||||||
|
|
||||||
[color "status"]
|
[color "status"]
|
||||||
added = 42
|
added = "#2CB494"
|
||||||
changed = 226
|
changed = "#F88C14"
|
||||||
untracked = 196
|
untracked = "#808080" italic
|
||||||
branch = 45
|
branch = "#2CB494"
|
||||||
|
header = "#CCE0D0"
|
||||||
[color "diff"]
|
[color "diff"]
|
||||||
meta = 91
|
meta = "#88409C"
|
||||||
frag = 45
|
frag = "#4068D4"
|
||||||
old = 196
|
old = "#F40404"
|
||||||
new = 42
|
new = "#2CB494"
|
||||||
context = 252
|
context = "#808080"
|
||||||
|
commit = "#F88C14"
|
||||||
[color "branch"]
|
[color "branch"]
|
||||||
current = 45
|
current = "#2CB494" bold
|
||||||
local = 252
|
local = "#CCE0D0"
|
||||||
remote = 27
|
remote = "#4068D4"
|
||||||
|
upstream = "#7290B8"
|
||||||
[color "decorate"]
|
[color "decorate"]
|
||||||
branch = 45
|
branch = "#2CB494"
|
||||||
remoteBranch = 27
|
remoteBranch = "#4068D4"
|
||||||
tag = 226
|
tag = "#F88C14"
|
||||||
stash = 201
|
stash = "#88409C"
|
||||||
|
HEAD = "#F88C14" bold
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
|
l = log --pretty=format:"%C(#F88C14)%h\\ %ad%C(#2CB494)%d\\ %Creset%s%C(#808080)\\ [%cn]" --decorate --date=short
|
||||||
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
|
ls = log --pretty=format:"%C(#F88C14)%h%C(#2CB494)%d\\ %Creset%s%C(#808080)\\ [%cn]" --decorate
|
||||||
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
|
ll = log --pretty=format:"%C(#F88C14)%h%C(#2CB494)%d\\ %Creset%s%C(#808080)\\ [%cn]" --decorate --numstat
|
||||||
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
|
ld = log --pretty=format:"%C(#F88C14)%h\\ %ad%C(#2CB494)%d\\ %Creset%s%C(#808080)\\ [%cn]" --decorate --date=relative
|
||||||
le = log --oneline --decorate
|
le = log --oneline --decorate
|
||||||
lg = log --graph --decorate --oneline
|
lg = log --graph --decorate --oneline
|
||||||
d = diff
|
d = diff
|
||||||
|
|||||||
@@ -12,6 +12,22 @@ export VISUAL=vim
|
|||||||
export PAGER=less
|
export PAGER=less
|
||||||
export BAT_THEME=dots
|
export BAT_THEME=dots
|
||||||
|
|
||||||
|
# Man pages via bat for syntax highlighting
|
||||||
|
export MANPAGER="sh -c 'col -bx | sed -e \"s/\x1b\[[0-9;]*m//g\" | bat -l man -p'"
|
||||||
|
|
||||||
|
# Less colours for bold/underline (man pages fallback)
|
||||||
|
export LESS="-R --mouse"
|
||||||
|
export LESS_TERMCAP_mb=$'\e[1;38;2;248;140;20m'
|
||||||
|
export LESS_TERMCAP_md=$'\e[1;38;2;64;104;212m'
|
||||||
|
export LESS_TERMCAP_me=$'\e[0m'
|
||||||
|
export LESS_TERMCAP_so=$'\e[38;2;26;26;26;48;2;44;180;148m'
|
||||||
|
export LESS_TERMCAP_se=$'\e[0m'
|
||||||
|
export LESS_TERMCAP_us=$'\e[4;38;2;44;180;148m'
|
||||||
|
export LESS_TERMCAP_ue=$'\e[0m'
|
||||||
|
|
||||||
|
# Use bat as a colourised pager for less
|
||||||
|
export LESSOPEN="| bat --color=always --style=plain %s 2>/dev/null"
|
||||||
|
|
||||||
# Homebrew
|
# Homebrew
|
||||||
export HOMEBREW_NO_ANALYTICS=1
|
export HOMEBREW_NO_ANALYTICS=1
|
||||||
export HOMEBREW_NO_ENV_HINTS=1
|
export HOMEBREW_NO_ENV_HINTS=1
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ set -g status-style "fg=#728cb8,bg=default"
|
|||||||
set -g status-left "#{?client_prefix,#[fg=#2cb494]● ,#[fg=#3c3c3c]● }"
|
set -g status-left "#{?client_prefix,#[fg=#2cb494]● ,#[fg=#3c3c3c]● }"
|
||||||
set -g status-right "#(~/.tmux/battery.sh) #[fg=#808080,bg=default]%a %d %b #[fg=#2cb494,bg=#1a1a1a] %H:%M #[default] "
|
set -g status-right "#(~/.tmux/battery.sh) #[fg=#808080,bg=default]%a %d %b #[fg=#2cb494,bg=#1a1a1a] %H:%M #[default] "
|
||||||
set -g status-right-length 60
|
set -g status-right-length 60
|
||||||
set -g window-status-format " #I #W "
|
set -g window-status-format "#{?window_last_flag, #[fg=#1a7a64]#I#[fg=default] #W , #I #W }"
|
||||||
set -g window-status-current-format " #[fg=#085040]#I#[fg=#0a0a0a] #W "
|
set -g window-status-current-format " #[fg=#085040]#I#[fg=#0a0a0a] #W "
|
||||||
set -g window-status-separator " "
|
set -g window-status-separator " "
|
||||||
set -g window-status-style "fg=#808080,bg=#1a1a1a"
|
set -g window-status-style "fg=#808080,bg=#1a1a1a"
|
||||||
|
|||||||
@@ -26,8 +26,16 @@ if [[ -n "$full" ]]; then
|
|||||||
echo "#[fg=#808080] AC#[default]"
|
echo "#[fg=#808080] AC#[default]"
|
||||||
elif [[ -n "$charging" ]]; then
|
elif [[ -n "$charging" ]]; then
|
||||||
echo "#[fg=#808080] ${pct}%#[default]"
|
echo "#[fg=#808080] ${pct}%#[default]"
|
||||||
|
elif (( pct <= 10 )); then
|
||||||
|
echo "#[fg=#F40404,bold] ${pct}%#[default]"
|
||||||
elif (( pct <= 20 )); then
|
elif (( pct <= 20 )); then
|
||||||
echo "#[fg=#f88c14,bold] ${pct}%#[default]"
|
echo "#[fg=#f88c14,bold] ${pct}%#[default]"
|
||||||
|
elif (( pct <= 40 )); then
|
||||||
|
echo "#[fg=#808080] ${pct}%#[default]"
|
||||||
|
elif (( pct <= 60 )); then
|
||||||
|
echo "#[fg=#808080] ${pct}%#[default]"
|
||||||
|
elif (( pct <= 80 )); then
|
||||||
|
echo "#[fg=#808080] ${pct}%#[default]"
|
||||||
else
|
else
|
||||||
echo "#[fg=#808080] ${pct}%#[default]"
|
echo "#[fg=#808080] ${pct}%#[default]"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -73,9 +73,16 @@ _dots_abbrev_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_dots_session() {
|
_dots_session() {
|
||||||
[[ -n "$CODESPACE_NAME" ]] && { print -r -- "$CODESPACE_NAME"; return }
|
local name=""
|
||||||
[[ -n "$SSH_CONNECTION" || -n "$SSH_CLIENT" || -n "$SSH_TTY" ]] && { print -r -- "%n@%m"; return }
|
if [[ -n "$CODESPACE_NAME" ]]; then
|
||||||
[[ -f /.dockerenv ]] && { print -r -- "${DEVCONTAINER_ID:-$(</etc/hostname)}"; return }
|
# Strip final random suffix (e.g. "redesigned-couscous-jp5676rpq5h5wrj" -> "redesigned-couscous")
|
||||||
|
name="${CODESPACE_NAME%-*}"
|
||||||
|
elif [[ -n "$SSH_CONNECTION" || -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
||||||
|
name="%n@%m"
|
||||||
|
elif [[ -f /.dockerenv ]]; then
|
||||||
|
name="${DEVCONTAINER_ID:-$(</etc/hostname)}"
|
||||||
|
fi
|
||||||
|
[[ -n "$name" ]] && print -r -- "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
_dots_git_info_sync() {
|
_dots_git_info_sync() {
|
||||||
@@ -260,7 +267,7 @@ _dots_precmd() {
|
|||||||
(( e )) && rp_parts+=("${_dots_pc[red]}[${e}]${_dots_pc[reset]}")
|
(( e )) && rp_parts+=("${_dots_pc[red]}[${e}]${_dots_pc[reset]}")
|
||||||
|
|
||||||
local session="$(_dots_session)"
|
local session="$(_dots_session)"
|
||||||
[[ -n "$session" ]] && rp_parts+=("${_dots_pc[orange]}[${session}]${_dots_pc[reset]}")
|
[[ -n "$session" ]] && rp_parts+=("${_dots_pc[dark_bg]}${_dots_pc[dark]}[${_dots_pc[orange]}${session}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]}]${_dots_pc[reset]}")
|
||||||
|
|
||||||
RPROMPT="${(j: :)rp_parts}"
|
RPROMPT="${(j: :)rp_parts}"
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,48 @@ _dots_load_keybindings() {
|
|||||||
zle -N _dots_git_branch_widget
|
zle -N _dots_git_branch_widget
|
||||||
bindkey '^B' _dots_git_branch_widget
|
bindkey '^B' _dots_git_branch_widget
|
||||||
|
|
||||||
# Ctrl+E: edit file
|
# Ctrl+E: edit file (frecency + git status boost)
|
||||||
_dots_edit_widget() {
|
_dots_edit_widget() {
|
||||||
local file
|
local file edit_log="${XDG_DATA_HOME:-$HOME/.local/share}/edit/log"
|
||||||
file="$(rg --files --hidden --glob '!.git' 2>/dev/null \
|
file="$({
|
||||||
| fzf --preview 'bat --color=always --style=numbers --line-range=:100 {} || head -100 {}')" || { zle reset-prompt; return; }
|
awk -v logfile="$edit_log" '
|
||||||
|
BEGIN {
|
||||||
|
while ((getline line < logfile) > 0) {
|
||||||
|
idx = index(line, "\t")
|
||||||
|
if (idx) { f = substr(line, idx+1); cnt[f]++; ts[f] = substr(line, 1, idx-1)+0 }
|
||||||
|
}
|
||||||
|
close(logfile)
|
||||||
|
cmd = "git status --porcelain 2>/dev/null"
|
||||||
|
while ((cmd | getline line) > 0) {
|
||||||
|
st = substr(line, 1, 2); f = substr(line, 4)
|
||||||
|
if ((i = index(f, " -> ")) > 0) f = substr(f, i+4)
|
||||||
|
gsub(/^"|"$/, "", f)
|
||||||
|
if (st !~ /D/) git[f] = st
|
||||||
|
}
|
||||||
|
close(cmd)
|
||||||
|
for (f in cnt) {
|
||||||
|
s = cnt[f] * 1000 + ts[f]
|
||||||
|
if (f in git) { s += 100000; printf "%d\t%s\t%s\n", s, clr(git[f]), f; delete git[f] }
|
||||||
|
else printf "%d\t \t%s\n", s, f
|
||||||
|
}
|
||||||
|
for (f in git) printf "100000\t%s\t%s\n", clr(git[f]), f
|
||||||
|
}
|
||||||
|
function clr(st) {
|
||||||
|
if (st ~ /^\?\?/) return "\033[90m?\033[0m"
|
||||||
|
if (st ~ /^R/) return "\033[36mR\033[0m"
|
||||||
|
if (st ~ /^A/) return "\033[32mA\033[0m"
|
||||||
|
if (st ~ /M/) return "\033[33mM\033[0m"
|
||||||
|
return "\033[90m~\033[0m"
|
||||||
|
}' /dev/null 2>/dev/null | sort -rn | cut -f2-
|
||||||
|
rg --files --hidden --glob '!.git' 2>/dev/null | awk '{print " \t" $0}'
|
||||||
|
} | awk -F'\t' '!seen[$2]++' \
|
||||||
|
| fzf --ansi --delimiter='\t' --nth=2 \
|
||||||
|
--preview 'bat --color=always --style=numbers --line-range=:100 {2} 2>/dev/null || head -100 {2}')" \
|
||||||
|
|| { zle reset-prompt; return; }
|
||||||
|
file="$(printf '%s' "$file" | cut -f2)"
|
||||||
|
[[ -z "$file" ]] && { zle reset-prompt; return; }
|
||||||
|
mkdir -p "${edit_log:h}"
|
||||||
|
printf '%s\t%s\n' "$(date +%s)" "$file" >> "$edit_log"
|
||||||
BUFFER="${EDITOR:-vim} ${(q)file}"
|
BUFFER="${EDITOR:-vim} ${(q)file}"
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
zle accept-line
|
zle accept-line
|
||||||
|
|||||||
29
install.d/26-bat.sh
Normal file
29
install.d/26-bat.sh
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Description:
|
||||||
|
# Install bat and build theme cache from dotfiles.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ! command -v bat &> /dev/null; then
|
||||||
|
case "$DOTS_PKG" in
|
||||||
|
brew)
|
||||||
|
brew install bat
|
||||||
|
;;
|
||||||
|
apt)
|
||||||
|
sudo apt-get install -qq bat
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -S --noconfirm bat
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_warn "Skipping bat install: no supported package manager found"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
bat --version | log_quote
|
||||||
|
|
||||||
|
bat cache --build --quiet
|
||||||
|
log_pass "bat theme cache built"
|
||||||
Reference in New Issue
Block a user