tmux prompt goodness

This commit is contained in:
Daniel Lundin 2020-09-28 23:16:07 +02:00
parent 6d507fab49
commit 0c880b5597
No known key found for this signature in database
GPG key ID: 6AB527C9196ACDCC
4 changed files with 109 additions and 59 deletions

View file

@ -0,0 +1,26 @@
tmux:
symbols:
branch: '⎇ '
hashprefix: ':'
ahead: ↑·
behind: ↓·
staged: '● '
conflict: '✖ '
modified: ' !'
untracked: '?'
stashed: '⚑ '
clean: ' ✔ '
styles:
clear: '#[fg=default]'
state: '#[bg=red,fg=white]'
branch: '#[fg=#e0f2f1,bg=#00796b] '
remote: '#[fg=cyan]'
staged: '#[fg=green]'
conflict: '#[fg=red]'
modified: '#[fg=#827717,bg=#ffc107]'
untracked: '#[fg=magenta,bg=#ffc107]'
stashed: '#[fg=cyan]'
clean: '#[fg=#e8f5e9,bg=#33691e]'
layout: [branch, divergence, ' ', flags, ' ']
options:
branch_max_len: 0

View file

@ -1,47 +1,11 @@
add_newline = true
add_newline = false
prompt_order = [
"username",
"username",
"hostname",
"kubernetes",
"directory",
"git_branch",
"git_commit",
"git_state",
"git_status",
"hg_branch",
"docker_context",
"package",
"dotnet",
"elixir",
"elm",
"erlang",
"golang",
"java",
"julia",
"kubernetes",
"nim",
"nodejs",
"ocaml",
"php",
"purescript",
"python",
"ruby",
"rust",
"terraform",
"zig",
"nix_shell",
"conda",
"memory_usage",
"aws",
"env_var",
"crystal",
"cmd_duration",
"custom",
"line_break",
"jobs",
"battery",
"time",
"git_state",
"character",
]
@ -49,10 +13,26 @@ prompt_order = [
symbol = "%%"
[line_break]
disabled = false
disabled = true
[directory]
fish_style_pwd_dir_length = 2
fish_style_pwd_dir_length = 1
truncation_length = 1
truncate_to_repo = false
style = "bold"
[git_branch]
style = ""
[git_commit]
style = ""
[git_state]
style = ""
[git_status]
style = ""
[kubernetes]
disabled = false
style = ""

View file

@ -53,13 +53,14 @@ bind-key -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 1 scroll-up
bind-key -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-down
setw -g window-status-format ""
setw -g window-status-current-format ""
setw -g window-status-separator ""
set -g status-justify left
set -g status-left ""
set -g status-format "#I:#T"
set -g status-right ""
set -g status-style "bg=#455a64,fg=#f5f5f5"
set -g status-left-length 0
set -g status-left "#[bg=#263238,fg=#78909C] #I #[bg=#455a64,fg=#cfd8dc] #{=|60|…:pane_current_path} "
set -g status-right '#[bg=#0d47a1,fg=#e1f5fe] ☸ #(kubectl config current-context) #(gitmux -cfg ~/.config/gitmux/gitmux.yaml "#{pane_current_path}")'
set -g set-titles on
set -g set-titles-string "#H:#T"
set -g status-style "fg=#EFEBE9,bg=#404040"
# vim:set ft=tmux:

69
.zshrc
View file

@ -4,8 +4,8 @@ zplug "plugins/git", from:oh-my-zsh
zplug "zsh-users/zsh-completions"
zplug 'zsh-users/zsh-syntax-highlighting', defer:2
zplug 'zsh-users/zsh-history-substring-search', defer:3
zplug 'zsh-users/zsh-autosuggestions'
zplug 'Aloxaf/fzf-tab'
# zplug 'zsh-users/zsh-autosuggestions'
# zplug 'Aloxaf/fzf-tab'
if ! zplug check --verbose; then
printf "Install? [y/N]: "
@ -48,17 +48,60 @@ autoload -Uz compinit
compinit
## Autosuggest
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#D7CCC8,italic"
ZSH_AUTOSUGGEST_USE_ASYNC=1
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
bindkey '^ ' autosuggest-accept
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#D7CCC8,italic"
# ZSH_AUTOSUGGEST_USE_ASYNC=1
# ZSH_AUTOSUGGEST_STRATEGY=(history completion)
## fasd
alias a='fasd -a' # any
alias s='fasd -si' # show / search / select
alias d='fasd -d' # directory
alias f='fasd -f' # file
alias sd='fasd -sid' # interactive directory selection
alias sf='fasd -sif' # interactive file selection
alias z='fasd_cd -d' # cd, same functionality as j in autojump
alias zz='fasd_cd -d -i' # cd with interactive selection
eval "$(fasd --init posix-alias zsh-hook)"
cd_func () {
local dir
if [[ $1 == "--" ]]; then
_jump || return 1
return 0
elif [[ -z "$1" ]]; then
dir="$HOME"
else
dir="$@"
fi
"cd" "${dir}"
fasd -A $PWD
}
alias cd=cd_func
redraw-prompt() {
local precmd
for precmd in $precmd_functions; do
$precmd
done
zle reset-prompt
}
zle -N redraw-prompt
_jump() {
dir="$(fasd -Rdlt | fzf --tiebreak=end -1 -0 --no-sort +m --height 10)" && cd_func "${dir}"
zle && zle redraw-prompt
}
zle -N _jump
## Keybindings
bindkey -e
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward
bindkey '^g' _jump
## Gnupg / gpg / ssh / yubikey
@ -116,13 +159,13 @@ GOPROXY=https://proxy.golang.org/
export ANSIBLE_NOCOWS=1
## Prompt
function set_win_title(){
echo -ne "\033]0;${PWD}\007"
function _pre(){
# echo -ne "\033]0;${PWD}\007"
tmux refresh-client -S
}
starship_precmd_user_func="set_win_title"
precmd_functions+=(set_win_title)
starship_precmd_user_func="_pre"
precmd_functions+=(_pre)
eval "$(starship init zsh)"
export PATH=$HOME/bin:$PATH