Nord-themed Wayland setup on sway (via uwsm), including: - sway/swayidle/swaylock/swaddle — WM, idle/lock/inhibit - waybar, rofi — bar and launcher - dunst — notifications - foot — terminal - zsh (+fzf, syntax highlighting, autosuggestions) — shell - mpd/rmpc/mpc, mpv — music and video - nvim — editor (lazy.nvim) - ly — login manager - rbw + pinentry-rofi wrapper — Bitwarden/Vaultwarden CLI - per-window-layout, clipvault — helper systemd services
165 lines
4.9 KiB
Bash
165 lines
4.9 KiB
Bash
HISTFILE="$HOME/.zsh_history"
|
||
HISTSIZE=10000
|
||
SAVEHIST=10000
|
||
|
||
bindkey -v
|
||
KEYTIMEOUT=1
|
||
|
||
setopt APPEND_HISTORY
|
||
setopt SHARE_HISTORY
|
||
setopt PROMPT_SUBST
|
||
|
||
autoload -U compinit
|
||
compinit
|
||
source <(fzf --zsh)
|
||
|
||
if [[ -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
|
||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||
fi
|
||
|
||
if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
|
||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||
fi
|
||
|
||
if [[ -f ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zsh ]]; then
|
||
source ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zsh
|
||
fi
|
||
|
||
if [[ -f ~/.zsh/plugins/fzf-tab-completion/zsh/fzf-tab-completion.plugin.zsh ]]; then
|
||
source ~/.zsh/plugins/fzf-tab-completion/zsh/fzf-tab-completion.plugin.zsh
|
||
fi
|
||
|
||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||
ZSH_HIGHLIGHT_STYLES[default]='fg=#eceff4'
|
||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#bf616a'
|
||
ZSH_HIGHLIGHT_STYLES[command]='fg=#88c0d0'
|
||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#88c0d0'
|
||
ZSH_HIGHLIGHT_STYLES[alias]='fg=#8fbcbb'
|
||
ZSH_HIGHLIGHT_STYLES[function]='fg=#88c0d0'
|
||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=#81a1c1,bold'
|
||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#81a1c1'
|
||
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#d08770'
|
||
ZSH_HIGHLIGHT_STYLES[path]='fg=#eceff4,underline'
|
||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#eceff4,underline'
|
||
ZSH_HIGHLIGHT_STYLES[optstring]='fg=#ebcb8b'
|
||
ZSH_HIGHLIGHT_STYLES[argument-base]='fg=#eceff4'
|
||
ZSH_HIGHLIGHT_STYLES[dollar-parameter]='fg=#b48ead'
|
||
ZSH_HIGHLIGHT_STYLES[dollar-parameter_extension]='fg=#b48ead'
|
||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#a3be8c'
|
||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#a3be8c'
|
||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#a3be8c'
|
||
ZSH_HIGHLIGHT_STYLES[comment]='fg=#4c566a,italic'
|
||
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#ebcb8b'
|
||
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#d08770'
|
||
|
||
zstyle ':fzf-tab:*' fzf-flags \
|
||
--color=fg:#eceff4,bg:#2e3440,fg+:#eceff4,bg+:#3b4252 \
|
||
--color=hl:#88c0d0,hl+:#88c0d0,info:#b48ead,prompt:#81a1c1 \
|
||
--color=pointer:#88c0d0,marker:#a3be8c,spinner:#88c0d0,header:#5e81ac \
|
||
--color=border:#4c566a,label:#8fbcbb,query:#eceff4 \
|
||
--color=preview-fg:#eceff4,preview-bg:#2e3440,preview-border:#4c566a,preview-label:#8fbcbb \
|
||
--color=gutter:#3b4252,separator:#434c5e,scrollbar:#5e81ac,preview-scrollbar:#5e81ac \
|
||
--color=disabled:#4c566a \
|
||
--prompt='❯ '
|
||
|
||
export FZF_DEFAULT_OPTS="
|
||
--color=fg:#eceff4,bg:#2e3440,fg+:#eceff4,bg+:#3b4252
|
||
--color=hl:#88c0d0,hl+:#88c0d0,info:#b48ead,prompt:#81a1c1
|
||
--color=pointer:#88c0d0,marker:#a3be8c,spinner:#88c0d0,header:#5e81ac
|
||
--color=border:#4c566a,label:#8fbcbb,query:#eceff4
|
||
--color=preview-fg:#eceff4,preview-bg:#2e3440,preview-border:#4c566a,preview-label:#8fbcbb
|
||
--color=gutter:#3b4252,separator:#434c5e,scrollbar:#5e81ac,preview-scrollbar:#5e81ac
|
||
--color=disabled:#4c566a
|
||
--prompt='❯ '
|
||
"
|
||
|
||
prompt_symbol() {
|
||
if [[ "$KEYMAP" == "vicmd" ]]; then
|
||
print -r -- "%F{#ebcb8b}❮%f"
|
||
else
|
||
print -r -- "%F{#88c0d0}❯%f"
|
||
fi
|
||
}
|
||
|
||
update_vim_prompt() {
|
||
zle reset-prompt
|
||
}
|
||
|
||
zle-keymap-select() {
|
||
update_vim_prompt
|
||
}
|
||
|
||
zle-line-init() {
|
||
zle -K viins
|
||
update_vim_prompt
|
||
}
|
||
|
||
git_prompt_info() {
|
||
local branch
|
||
local staged
|
||
local modified
|
||
local untracked
|
||
local deleted
|
||
local conflicts
|
||
local git_state=""
|
||
|
||
branch=$(git branch --show-current 2>/dev/null)
|
||
|
||
# Не Git-репозиторий
|
||
if [[ -z "$branch" ]]; then
|
||
return
|
||
fi
|
||
|
||
staged=$(git diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ')
|
||
modified=$(git diff --name-only 2>/dev/null | wc -l | tr -d ' ')
|
||
untracked=$(git ls-files --others --exclude-standard 2>/dev/null | wc -l | tr -d ' ')
|
||
deleted=$(git diff --name-only --diff-filter=D 2>/dev/null | wc -l | tr -d ' ')
|
||
conflicts=$(git diff --name-only --diff-filter=U 2>/dev/null | wc -l | tr -d ' ')
|
||
|
||
if (( staged > 0 )); then
|
||
git_state+=" %F{#b48ead} ${staged}%f"
|
||
fi
|
||
if (( modified > 0 )); then
|
||
git_state+=" %F{#ebcb8b} ${modified}%f"
|
||
fi
|
||
if (( untracked > 0 )); then
|
||
git_state+=" %F{#a3be8c} ${untracked}%f"
|
||
fi
|
||
if (( deleted > 0 )); then
|
||
git_state+=" %F{#d08770} ${deleted}%f"
|
||
fi
|
||
if (( conflicts > 0 )); then
|
||
git_state+=" %F{#bf616a} ${conflicts}%f"
|
||
fi
|
||
if [[ -n "$git_state" ]]; then
|
||
git_state=" %F{#88c0d0}❯%f${git_state}"
|
||
fi
|
||
|
||
print -r -- " %F{#88c0d0}❯%f %F{#8fbcbb} ${branch}%f${git_state}"
|
||
}
|
||
|
||
precmd() {
|
||
local exit_code=$?
|
||
|
||
if (( exit_code != 0 )); then
|
||
PROMPT_EXIT="%F{#941703}✗${exit_code}%f "
|
||
else
|
||
PROMPT_EXIT=""
|
||
fi
|
||
}
|
||
|
||
nvim() {
|
||
printf '\033]0;nvim\007'
|
||
command nvim "$@"
|
||
printf '\033]0;foot\007'
|
||
}
|
||
|
||
zle -N zle-keymap-select
|
||
zle -N zle-line-init
|
||
|
||
PROMPT='%F{#eceff4}%~%f$(git_prompt_info) $(prompt_symbol) '
|
||
|
||
vi() { nvim "$@"; }
|
||
vim() { nvim "$@"; }
|
||
alias rmpc='printf "\033]0;rmpc\007"; command rmpc; printf "\033]0;foot\007"'
|