vim: add plugins, tmux: status bar, fix Ctrl+A clash
- Add vim-gitgutter, vim-commentary, vim-surround via install script - Rebind git log widget from Ctrl+A to Ctrl+T (tmux prefix clash) - Add date, time, and battery indicator to tmux status bar - Set tmux clock colour to teal Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,7 @@ set -g status-position bottom
|
||||
set -g status-interval 5
|
||||
set -g status-style "fg=#728cb8,bg=default"
|
||||
set -g status-left ""
|
||||
set -g status-right ""
|
||||
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"
|
||||
@@ -71,6 +71,7 @@ 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"
|
||||
|
||||
# Auto-rename
|
||||
# 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}}'
|
||||
|
||||
28
home/.tmux/battery.sh
Executable file
28
home/.tmux/battery.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Battery indicator for tmux status bar.
|
||||
# Shows percentage only when on battery; amber when <=20%.
|
||||
|
||||
pct=""
|
||||
charging=""
|
||||
|
||||
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
|
||||
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
|
||||
fi
|
||||
|
||||
[[ -z "$pct" ]] && exit 0
|
||||
|
||||
if [[ -n "$charging" ]]; then
|
||||
echo "#[fg=#808080]AC#[default]"
|
||||
elif (( pct <= 20 )); then
|
||||
echo "#[fg=#f88c14,bold]${pct}%#[default]"
|
||||
else
|
||||
echo "#[fg=#808080]${pct}%#[default]"
|
||||
fi
|
||||
@@ -16,6 +16,7 @@ set undolevels=1000
|
||||
set undoreload=10000
|
||||
set belloff=all
|
||||
set noerrorbells
|
||||
set signcolumn=yes
|
||||
|
||||
set lazyredraw
|
||||
set synmaxcol=500
|
||||
@@ -127,6 +128,9 @@ highlight Conceal guifg=#808080
|
||||
highlight CursorLine guibg=#0A2A1A gui=NONE
|
||||
highlight CursorColumn guibg=#0A2A1A
|
||||
highlight SignColumn guifg=#808080 guibg=NONE
|
||||
highlight GitGutterAdd guifg=#2CB494 guibg=NONE
|
||||
highlight GitGutterChange guifg=#4068D4 guibg=NONE
|
||||
highlight GitGutterDelete guifg=#F40404 guibg=NONE
|
||||
highlight WarningMsg guifg=#FCFC38
|
||||
highlight ErrorMsg guifg=#F40404 gui=bold
|
||||
highlight ModeMsg guifg=#CCE0D0 gui=bold
|
||||
|
||||
@@ -91,7 +91,7 @@ _dots_load_keybindings() {
|
||||
zle -N _dots_find_in_files_widget
|
||||
bindkey '^F' _dots_find_in_files_widget
|
||||
|
||||
# Ctrl+A: git log browser
|
||||
# Ctrl+Q: git log browser
|
||||
_dots_git_log_widget() {
|
||||
local commit
|
||||
commit="$(git log --oneline --color --decorate -50 2>/dev/null \
|
||||
@@ -103,7 +103,7 @@ _dots_load_keybindings() {
|
||||
zle accept-line
|
||||
}
|
||||
zle -N _dots_git_log_widget
|
||||
bindkey '^A' _dots_git_log_widget
|
||||
bindkey '^Q' _dots_git_log_widget
|
||||
|
||||
# Ctrl+K: command help lookup
|
||||
_dots_help_widget() {
|
||||
|
||||
Reference in New Issue
Block a user