1
0
Fork 0

better titlestrings

This commit is contained in:
Luca Bilke 2023-06-14 22:12:51 +02:00
parent 921ab05d42
commit c5a98cc0e2
3 changed files with 18 additions and 11 deletions

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
kitty +kitten icat --clear --transfer-mode file

View File

@ -9,7 +9,6 @@ set wrapscroll
set period 1
set previewer ~/.config/lf/preview
set cleaner ~/.config/lf/clean
set promptfmt "\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m%d\033[33m%f\033[35m]\033[0m"
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
@ -95,8 +94,9 @@ cmd link %{{
cmd bulkrename $vidir
cmd on-cd &{{
DIR=$(echo $PWD | sed "s|$HOME|~|")
printf "\033]0; $DIR\007" > /dev/tty
printf "%b" "\033]0;$(zsh -c 'source $XDG_CONFIG_HOME/zsh/configs/autogenerated/hashes; print -Pn "$USER@$HOST [%3~]"') \007" > /dev/tty
fmt="\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m$(zsh -c 'source $XDG_CONFIG_HOME/zsh/configs/autogenerated/hashes; print -Pn "%3~"')\033[35m]\033[32m » \033[33m%f\033[0m"
lf -remote "send $id set promptfmt \"$fmt\""
}}
on-cd

View File

@ -52,8 +52,18 @@ zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Set the titlestring
function write_title_cmd() {
if [ ${1[(w)1]} != "lfwrap" ]; then
echo -ne "\033]0;$(print -P "%n@%m [%3~] » ${1[(w)1]}")\007"
fi
}
add-zsh-hook preexec write_title_cmd
function write_title_wd() { echo -ne "\033]0;$(print -P "%n@%m [%3~]")\007" }
add-zsh-hook precmd write_title_wd
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
lfwrap () {
tmp="$(mktemp)"
fid="$(mktemp)"
lf -command '$printf $id > '"$fid"'' -last-dir-path="$tmp" "$@"
@ -75,12 +85,12 @@ lfcd () {
tput cuu1;tput el
}
_lfcd () {
BUFFER="lfcd"
_lf () {
BUFFER="lfwrap"
zle accept-line
}
zle -N _lfcd
bindkey '^e' _lfcd
zle -N _lf
bindkey '^e' _lf
# bind lazygit to ctrl-g
lg () {