tmux, vim, terminal theming

This commit is contained in:
2026-02-24 18:57:23 +00:00
parent 7d2825f9d1
commit 76f61dc5fe
10 changed files with 470 additions and 37 deletions

2
home/.config/bat/config Normal file
View File

@@ -0,0 +1,2 @@
--map-syntax="*.arch:Dockerfile"
--map-syntax="*.debian:Dockerfile"

View File

@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>dots</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CCE0D0</string>
<key>background</key>
<string>#00000000</string>
<key>caret</key>
<string>#CCE0D0</string>
<key>selection</key>
<string>#1A3050</string>
<key>lineHighlight</key>
<string>#0A2A1A</string>
<key>gutterForeground</key>
<string>#808080</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comment</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#808080</string>
<key>fontStyle</key>
<string>italic</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>String</string>
<key>scope</key>
<string>string</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#2CB494</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Number</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F88C14</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constant</string>
<key>scope</key>
<string>constant, constant.language, constant.character</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F88C14</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keyword</string>
<key>scope</key>
<string>keyword, keyword.control, keyword.operator.logical, keyword.operator.assignment, keyword.other, support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#4068D4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage, storage.type, storage.modifier</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#4068D4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Function</string>
<key>scope</key>
<string>entity.name.function, entity.name.tag, support.function.builtin</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#7290B8</string>
<key>fontStyle</key>
<string>bold</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Type</string>
<key>scope</key>
<string>entity.name.type, entity.name.class, support.type, support.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#2CB494</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variable</string>
<key>scope</key>
<string>variable, variable.parameter</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CCE0D0</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Operator</string>
<key>scope</key>
<string>keyword.operator</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CCE0D0</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Special</string>
<key>scope</key>
<string>constant.character.escape, string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#88409C</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Preprocessor</string>
<key>scope</key>
<string>meta.preprocessor, keyword.control.import, keyword.control.directive</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F88C14</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tag Attribute</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#7290B8</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Invalid</string>
<key>scope</key>
<string>invalid</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F40404</string>
<key>fontStyle</key>
<string>bold underline</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup Heading</string>
<key>scope</key>
<string>markup.heading, entity.name.section</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#7290B8</string>
<key>fontStyle</key>
<string>bold</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup Bold</string>
<key>scope</key>
<string>markup.bold</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup Italic</string>
<key>scope</key>
<string>markup.italic</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup Code</string>
<key>scope</key>
<string>markup.raw, markup.inline.raw</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F88C14</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup Link</string>
<key>scope</key>
<string>markup.underline.link, meta.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#4068D4</string>
<key>fontStyle</key>
<string>underline</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markup List</string>
<key>scope</key>
<string>markup.list punctuation.definition.list_item</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F88C14</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Punctuation</string>
<key>scope</key>
<string>punctuation.definition.heading, punctuation.definition.bold, punctuation.definition.italic</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#808080</string>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@@ -10,6 +10,7 @@ fi
export EDITOR=vim
export VISUAL=vim
export PAGER=less
export BAT_THEME=dots
# Homebrew
export HOMEBREW_NO_ANALYTICS=1

View File

@@ -6,6 +6,8 @@ bind C-a send-prefix
# True color
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# Shell
set -g default-shell "$SHELL"
@@ -58,20 +60,29 @@ bind r source-file ~/.tmux.conf \; display "Config reloaded"
# Status bar
set -g status-position bottom
set -g status-interval 5
set -g status-interval 1
set -g status-style "fg=#728cb8,bg=default"
set -g status-left ""
set -g status-right "#[fg=#808080]%a %d %b #[fg=#2cb494,bold]%H:%M #(~/.tmux/battery.sh)"
set -g window-status-format " #I:#W "
set -g window-status-current-format "#[fg=#2cb494,bold] #I:#W "
set -g window-status-bell-style "fg=#f88c14,bold"
set -g pane-border-style "fg=#728cb8"
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-length 60
set -g window-status-format " #I #W "
set -g window-status-current-format " #[fg=#085040]#I#[fg=#0a0a0a] #W "
set -g window-status-separator " "
set -g window-status-style "fg=#808080,bg=#1a1a1a"
set -g window-status-current-style "fg=#0a0a0a,bg=#2cb494,bold"
set -g window-status-bell-style "fg=#1a1a1a,bg=#f88c14,bold"
set -g monitor-bell on
set -g visual-bell off
set -g pane-border-style "fg=#3c3c3c"
set -g pane-active-border-style "fg=#2cb494"
set -g message-style "fg=#2cb494,bg=default"
set -g message-command-style "fg=#f88c14,bg=default"
set -g mode-style "fg=default,bg=#728cb8,bold"
set -g mode-style "fg=#1a1a1a,bg=#f88c14,bold"
set -g display-panes-colour "#808080"
set -g display-panes-active-colour "#2cb494"
# Clock
set -g clock-mode-colour "#2cb494"
set -g automatic-rename on
set -g automatic-rename-format '#{?#{==:#{pane_current_command},zsh},zsh:#{b:pane_current_path},#{pane_current_command}}'
set -g allow-rename off
set -g automatic-rename-format '#(~/.tmux/tab-name.sh "#{pane_current_command}" "#{b:pane_current_path}")'

View File

@@ -1,28 +1,33 @@
#!/usr/bin/env bash
# Battery indicator for tmux status bar.
# Shows percentage only when on battery; amber when <=20%.
# 󰚥 AC when full/plugged, 󰂄 charging with %, amber 󰂃 when <=20%.
pct=""
charging=""
full=""
if command -v pmset &>/dev/null; then
# macOS
info=$(pmset -g batt)
pct=$(echo "$info" | grep -o '[0-9]\+%' | head -1 | tr -d '%')
echo "$info" | grep -q 'AC Power' && charging=1
echo "$info" | grep -q 'charged\|finishing charge' && full=1
elif [[ -f /sys/class/power_supply/BAT0/capacity ]]; then
# Linux
pct=$(cat /sys/class/power_supply/BAT0/capacity)
status=$(cat /sys/class/power_supply/BAT0/status)
[[ "$status" == "Charging" || "$status" == "Full" ]] && charging=1
[[ "$status" == "Charging" ]] && charging=1
[[ "$status" == "Full" || "$status" == "Not charging" ]] && full=1
fi
[[ -z "$pct" ]] && exit 0
if [[ -n "$charging" ]]; then
echo "#[fg=#808080]AC#[default]"
if [[ -n "$full" ]]; then
echo "#[fg=#808080]󰚥 AC#[default]"
elif [[ -n "$charging" ]]; then
echo "#[fg=#808080]󰂄 ${pct}%#[default]"
elif (( pct <= 20 )); then
echo "#[fg=#f88c14,bold]${pct}%#[default]"
echo "#[fg=#f88c14,bold]󰂃 ${pct}%#[default]"
else
echo "#[fg=#808080]${pct}%#[default]"
echo "#[fg=#808080]󰁹 ${pct}%#[default]"
fi

19
home/.tmux/tab-name.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Tab name for tmux automatic-rename.
# Usage: tab-name.sh <command> <dirname>
# Shows dirname for shells, command for everything else. Truncates at 15 with ….
cmd="$1"
dir="$2"
max=15
case "$cmd" in
zsh|bash|fish|sh) name="$dir" ;;
*) name="$cmd" ;;
esac
if (( ${#name} > max )); then
echo "${name:0:$max}"
else
echo "$name"
fi

View File

@@ -58,6 +58,9 @@ set background=dark
if has('termguicolors') && ($COLORTERM ==# 'truecolor' || $COLORTERM ==# '24bit')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
let &t_AU = "\<Esc>[58:2::%lu:%lu:%lum"
let &t_Cs = "\<Esc>[4:3m"
let &t_Ce = "\<Esc>[4:0m"
set termguicolors
endif
@@ -104,9 +107,9 @@ highlight diffIndexLine guifg=#88409C
highlight diffLine guifg=#00E4FC
highlight diffSubname guifg=#F88C14
highlight SpellBad guifg=#F40404 gui=undercurl guisp=#F40404
highlight SpellCap guifg=#FCFC38 gui=undercurl guisp=#FCFC38
highlight SpellRare guifg=#88409C gui=undercurl guisp=#88409C
highlight SpellBad guifg=NONE guibg=#2A1A0A gui=NONE cterm=NONE ctermfg=NONE ctermbg=NONE
highlight SpellCap guifg=NONE guibg=#2A1A0A gui=NONE cterm=NONE ctermfg=NONE ctermbg=NONE
highlight SpellRare guifg=NONE guibg=#2A1A0A gui=NONE cterm=NONE ctermfg=NONE ctermbg=NONE
highlight Visual guibg=#1A3050
@@ -174,16 +177,66 @@ highlight htmlTagName guifg=#4068D4
highlight htmlLink guifg=#CCE0D0 gui=underline
highlight htmlTag guifg=#808080
highlight htmlEndTag guifg=#808080
highlight markdownH1 guifg=#7290B8 gui=bold
highlight markdownH2 guifg=#7290B8 gui=bold
highlight markdownH3 guifg=#7290B8 gui=bold
highlight markdownH4 guifg=#7290B8 gui=bold
highlight markdownH5 guifg=#7290B8 gui=bold
highlight markdownH6 guifg=#7290B8 gui=bold
highlight markdownH1Delimiter guifg=#808080
highlight markdownH2Delimiter guifg=#808080
highlight markdownH3Delimiter guifg=#808080
highlight markdownH4Delimiter guifg=#808080
highlight markdownH5Delimiter guifg=#808080
highlight markdownH6Delimiter guifg=#808080
highlight markdownCode guifg=#F88C14
highlight markdownCodeBlock guifg=#F88C14
highlight markdownCodeDelimiter guifg=#808080
highlight markdownUrl guifg=#4068D4 gui=underline
highlight markdownLinkText guifg=#2CB494
highlight markdownListMarker guifg=#F88C14
highlight markdownRule guifg=#808080
highlight markdownBold guifg=#CCE0D0 gui=bold
highlight markdownItalic guifg=#CCE0D0 gui=italic
highlight markdownBoldItalic guifg=#CCE0D0 gui=bold,italic
" YAML Groups
highlight yamlKey guifg=#7290B8
highlight yamlBlockMappingKey guifg=#7290B8
highlight yamlFlowMappingKey guifg=#7290B8
highlight yamlKeyValueDelimiter guifg=#808080
highlight yamlBlockCollectionItemStart guifg=#808080
highlight yamlBool guifg=#F88C14
highlight yamlNull guifg=#F88C14
highlight yamlInteger guifg=#F88C14
highlight yamlFloat guifg=#F88C14
highlight yamlAnchor guifg=#88409C
highlight yamlAlias guifg=#88409C
" Dockerfile Groups
highlight dockerfileKeyword guifg=#4068D4
highlight dockerfileFrom guifg=#4068D4 gui=bold
" Language-specific Groups
highlight pythonBuiltinObj guifg=#F88C14
highlight pythonBuiltinFunc guifg=#7290B8 gui=bold
highlight pythonBuiltinType guifg=#2CB494
highlight pythonDottedName guifg=#CCE0D0
highlight pythonDecorator guifg=#88409C
highlight pythonDecoratorName guifg=#88409C
highlight goBuiltins guifg=#7290B8 gui=bold
highlight goFormatSpecifier guifg=#88409C
highlight javaScriptFunction guifg=#4068D4
highlight javaScriptMember guifg=#7290B8
highlight typescriptBraces guifg=#CCE0D0
highlight typescriptParens guifg=#CCE0D0
highlight shVariable guifg=#CCE0D0
highlight shDerefSimple guifg=#CCE0D0
highlight shCommandSub guifg=#7290B8
highlight rubyInterpolation guifg=#88409C
highlight rubyInterpolationDelimiter guifg=#88409C
highlight rubyBlockParameter guifg=#CCE0D0

View File

@@ -13,23 +13,44 @@ _dots_init_colors() {
if [[ "$COLORTERM" == (truecolor|24bit) ]]; then
_dots_pc=(
teal $'%{\e[38;2;44;180;148m%}'
teal_bg $'%{\e[48;2;44;180;148m%}'
orange $'%{\e[38;2;248;140;20m%}'
red $'%{\e[38;2;244;4;4m%}'
grey $'%{\e[38;2;114;144;184m%}'
grey_bg $'%{\e[48;2;114;144;184m%}'
purple $'%{\e[38;2;136;64;156m%}'
purple_bg $'%{\e[48;2;136;64;156m%}'
bright $'%{\e[38;2;204;224;208m%}'
dark $'%{\e[38;2;26;26;26m%}'
dark_bg $'%{\e[48;2;26;26;26m%}'
)
elif [[ "$TERM" == *256color* ]]; then
_dots_pc=(
teal $'%{\e[38;5;43m%}'
teal_bg $'%{\e[48;5;43m%}'
orange $'%{\e[38;5;208m%}'
red $'%{\e[38;5;196m%}'
grey $'%{\e[38;5;103m%}'
grey_bg $'%{\e[48;5;103m%}'
purple $'%{\e[38;5;133m%}'
purple_bg $'%{\e[48;5;133m%}'
bright $'%{\e[38;5;188m%}'
dark $'%{\e[38;5;234m%}'
dark_bg $'%{\e[48;5;234m%}'
)
else
_dots_pc=(
teal $'%{\e[36m%}'
teal_bg $'%{\e[46m%}'
orange $'%{\e[33m%}'
red $'%{\e[31m%}'
grey $'%{\e[34m%}'
grey_bg $'%{\e[44m%}'
purple $'%{\e[35m%}'
purple_bg $'%{\e[45m%}'
bright $'%{\e[37m%}'
dark $'%{\e[30m%}'
dark_bg $'%{\e[40m%}'
)
fi
_dots_pc[reset]=$'%{\e[0m%}'
@@ -64,6 +85,7 @@ _dots_git_info_sync() {
output=$(git status --short --branch --ignore-submodules=dirty 2>/dev/null) || return
local branch="" ahead=0 behind=0 staged=0 unstaged=0 untracked=0
local detached=0
# Parse efficiently: branch info from first line, counts from rest
local first_line="${output%%$'\n'*}"
@@ -72,8 +94,12 @@ _dots_git_info_sync() {
if [[ "$first_line" == "## "* ]]; then
branch="${first_line#\#\# }"
# Handle detached HEAD
if [[ "$branch" == "HEAD (no branch)" || "$branch" == [0-9a-f]##* ]]; then
if [[ "$branch" == "HEAD (no branch)" ]]; then
branch=$(git rev-parse --short HEAD 2>/dev/null)
detached=1
elif [[ "$branch" == [0-9a-f]##* ]]; then
branch="${branch:0:7}"
detached=1
else
# Remove tracking info
branch="${branch%%...*}"
@@ -105,37 +131,47 @@ _dots_git_info_sync() {
unstaged=${counts[2]:-0}
untracked=${counts[3]:-0}
local info="${_dots_pc[grey]}(${branch})${_dots_pc[reset]}"
# Branch pill: grey for main/master, inverted teal for feature, amber for detached
local branch_pill
if (( detached )); then
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[orange]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
elif [[ "$branch" == (main|master) ]]; then
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[grey]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
else
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[purple]}${_dots_pc[bold]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
fi
local info="$branch_pill"
local dirty=""
local sep=""
if (( staged )); then
dirty+="${_dots_pc[teal]}+${staged}${_dots_pc[reset]}"
dirty+="${_dots_pc[teal]}+${staged}"
sep=" "
fi
if (( unstaged )); then
dirty+="${sep}${_dots_pc[orange]}~${unstaged}${_dots_pc[reset]}"
dirty+="${sep}${_dots_pc[orange]}~${unstaged}"
sep=" "
fi
if (( untracked )); then
dirty+="${sep}${_dots_pc[grey]}?${untracked}${_dots_pc[reset]}"
dirty+="${sep}${_dots_pc[grey]}?${untracked}"
fi
local arrows=""
sep=""
if (( ahead )); then
arrows+="${_dots_pc[teal]}${ahead}${_dots_pc[reset]}"
arrows+="${_dots_pc[teal]}${ahead}"
sep=" "
fi
if (( behind )); then
arrows+="${sep}${_dots_pc[orange]}${behind}${_dots_pc[reset]}"
arrows+="${sep}${_dots_pc[orange]}${behind}"
fi
if [[ -n "$dirty" || -n "$arrows" ]]; then
info+=" "
[[ -n "$dirty" ]] && info+="$dirty"
[[ -n "$dirty" && -n "$arrows" ]] && info+=" "
[[ -n "$arrows" ]] && info+="$arrows"
local stats=""
[[ -n "$dirty" ]] && stats+="$dirty"
[[ -n "$dirty" && -n "$arrows" ]] && stats+=" "
[[ -n "$arrows" ]] && stats+="$arrows"
info+=" ${stats}"
fi
print -r -- "$info"
@@ -155,7 +191,10 @@ _dots_git_async_callback() {
_dots_git_info_result="$result"
_dots_build_dots_prompt_base
PROMPT="$_dots_prompt_base"
zle && zle reset-prompt
# Only reset prompt if not in a special ZLE widget (e.g. fzf)
if zle && [[ "${WIDGET:-}" != _dots_* ]]; then
zle reset-prompt 2>/dev/null
fi
fi
# Clean up
exec {fd}<&-
@@ -187,7 +226,7 @@ _dots_build_dots_prompt_base() {
local symbol="${_dots_pc[grey]}${_dots_prompt_symbol}${_dots_pc[reset]}"
(( EUID == 0 )) && symbol="${_dots_pc[orange]}${_dots_pc[bold]}#${_dots_pc[reset]}"
local line1="${_dots_pc[teal]}${dir_path}${_dots_pc[reset]}"
local line1="${_dots_pc[dark_bg]}${_dots_pc[dark]}#${_dots_pc[teal]}${dir_path}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]}#${_dots_pc[reset]}"
[[ -n "$_dots_git_info_result" ]] && line1+=" ${_dots_git_info_result}"
_dots_prompt_base=$'\n'"${line1}"$'\n'"${symbol} "
@@ -246,7 +285,7 @@ TRAPINT() {
_dots_prompt_flashing=1
local git_part=""
[[ -n "$_dots_git_info_result" ]] && git_part=" ${_dots_git_info_result}"
local flash_prompt=$'\n'"${_dots_pc[teal]}$(_dots_abbrev_path)${_dots_pc[reset]}${git_part}"$'\n'$'%{\e[48;2;248;140;20m\e[30m%}'"${_dots_prompt_symbol}"$' %{\e[0m%}'
local flash_prompt=$'\n'"${_dots_pc[dark_bg]}${_dots_pc[dark]}#${_dots_pc[teal]}$(_dots_abbrev_path)${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]}#${_dots_pc[reset]}${git_part}"$'\n'$'%{\e[48;2;248;140;20m\e[30m%}'"${_dots_prompt_symbol}"$' %{\e[0m%}'
PROMPT="$flash_prompt"
zle reset-prompt
zselect -t $PROMPT_FLASH_DELAY

View File

@@ -30,7 +30,7 @@ _dots_load_keybindings() {
_dots_edit_widget() {
local file
file="$(rg --files --hidden --glob '!.git' 2>/dev/null \
| fzf --preview 'head -100 {}')" || { zle reset-prompt; return; }
| fzf --preview 'bat --color=always --style=numbers --line-range=:100 {} || head -100 {}')" || { zle reset-prompt; return; }
BUFFER="${EDITOR:-vim} ${(q)file}"
zle reset-prompt
zle accept-line
@@ -80,7 +80,7 @@ _dots_load_keybindings() {
local selection
selection="$(rg --color=always --line-number --no-heading --hidden --glob '!.git' '' 2>/dev/null \
| fzf --ansi --delimiter=: \
--preview 'head -n $((({2}+30))) {1} | tail -n 60' \
--preview 'n={2}; n=${n:-1}; bat --color=always --style=numbers --highlight-line=$n --line-range=$((n>30?n-30:1)):$((n+30)) {1} 2>/dev/null || head -n $(( n + 30 )) {1} 2>/dev/null | tail -n 60' \
--preview-window='right:60%')" || { zle -I; zle reset-prompt; return; }
local file="${selection%%:*}"
local line="${${selection#*:}%%:*}"

View File

@@ -22,13 +22,16 @@ _dots_cache_ls_colors() {
if [[ -f "$cache_file" ]]; then
source "$cache_file"
else
if ls --color -d . &>/dev/null; then
if command -v gls &>/dev/null; then
echo 'alias ls="gls --color=auto"' > "$cache_file"
elif ls --color -d . &>/dev/null 2>&1; then
echo 'alias ls="ls --color=auto"' > "$cache_file"
elif ls -G -d . &>/dev/null; then
elif ls -G -d . &>/dev/null 2>&1; then
echo 'alias ls="ls -G"' > "$cache_file"
fi
[[ -f "$cache_file" ]] && source "$cache_file"
fi
export LS_COLORS='di=38;2;44;180;148:ln=38;2;136;64;156:ex=38;2;248;140;20:fi=0:no=0:*.md=38;2;114;144;184:*.json=38;2;114;144;184:*.yml=38;2;114;144;184:*.yaml=38;2;114;144;184:*.toml=38;2;114;144;184'
}
_dots_cache_ls_colors
@@ -53,6 +56,14 @@ _dots_init_completion() {
else
compinit
fi
# Completion styling
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format $'\e[38;2;114;144;184m-- %d --\e[0m'
zstyle ':completion:*:warnings' format $'\e[38;2;244;4;4m-- no matches --\e[0m'
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
}
_dots_init_completion
@@ -60,9 +71,32 @@ _dots_load_plugins() {
local plugin_dir="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins"
local f="$plugin_dir/zsh-autosuggestions/zsh-autosuggestions.zsh"
[[ -f "$f" ]] && source "$f"
# Autosuggestion ghost text colour
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#3c3c3c'
# syntax-highlighting must be sourced last
f="$plugin_dir/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
[[ -f "$f" ]] && source "$f"
# Syntax highlighting theme
typeset -gA ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[command]='fg=#2cb494'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#2cb494'
ZSH_HIGHLIGHT_STYLES[alias]='fg=#2cb494'
ZSH_HIGHLIGHT_STYLES[function]='fg=#2cb494'
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#f40404'
ZSH_HIGHLIGHT_STYLES[path]='underline'
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#f88c14'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#728cb8'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#728cb8'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#728cb8'
ZSH_HIGHLIGHT_STYLES[comment]='fg=#808080'
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#2cb494'
ZSH_HIGHLIGHT_STYLES[default]='fg=#CCE0D0'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#808080'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=#f88c14'
ZSH_HIGHLIGHT_STYLES[option]='fg=#7290b8'
}
_dots_load_plugins
@@ -83,7 +117,7 @@ _dots_load_fzf() {
command -v fzf &>/dev/null || return
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS='--layout=reverse --height=40% --prompt="> " --info=inline-right --no-separator --margin=1,0,0,0'
export FZF_DEFAULT_OPTS='--style=minimal --layout=reverse --height=40% --border=none --no-scrollbar --prompt="> " --info=inline-right --no-separator --margin=1,0,0,0 --color=fg:#808080,fg+:#CCE0D0,bg:-1,bg+:#1a1a1a --color=hl:#2cb494,hl+:#2cb494,info:#808080,marker:#2cb494 --color=prompt:#2cb494,spinner:#88409C,pointer:#2cb494,header:#808080 --color=border:#3c3c3c,preview-border:#3c3c3c,gutter:#1a1a1a,preview-fg:#CCE0D0'
# fzf --zsh requires v0.48+
if fzf --zsh &>/dev/null; then
source <(fzf --zsh)