1
0
Fork 0

better titlestring handling

This commit is contained in:
Luca Bilke 2023-06-14 22:08:16 +02:00
parent ede7f8ca18
commit 9914cfa3bb
4 changed files with 11 additions and 12 deletions

View file

@ -95,9 +95,8 @@ cmd setbg "$1"
cmd bulkrename $vidir
cmd on-cd ${{
DIR=$(zsh -c 'cd $PWD && source /home/luca/.config/zsh/configs/autogenerated/hashes && print -P "%3~"')
printf "%b" "\033]0;$TERMINAL [$DIR] \007" > /dev/tty
fmt="\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m$DIR\033[35m]\033[32m » \033[33m%f\033[0m"
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

@ -1 +1 @@
Subproject commit 10e84671329a4c4423835934080aa9b1d11b7020
Subproject commit fb8bdf5cecaca7d5241807c2f790dbfbdd1c771d

View file

@ -22,9 +22,13 @@ function write_venv(){
add-zsh-hook precmd write_venv
# Set the titlestring
function write_title_cmd() { echo -ne "\033]0;$(print -P "$TERMINAL [%3~] » ${1[(w)1]}")\007" }
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 "$TERMINAL [%3~]")\007" }
function write_title_wd() { echo -ne "\033]0;$(print -P "%n@%m [%3~]")\007" }
add-zsh-hook precmd write_title_wd
reset_beam() { echo -ne '\e[5 q' } # Use beam shape cursor for each new prompt.

View file

@ -10,18 +10,15 @@ zsh_named_dirs="$ZDOTDIR/configs/autogenerated/hashes"
lf_files="$XDG_DATA_HOME/lf/shortcut-files"
lf_dirs="$XDG_DATA_HOME/lf/shortcut-dirs"
lf_shortcuts="$XDG_CONFIG_HOME/lf/shortcutrc"
nvim_dirs="$XDG_CONFIG_HOME/nvim/lua/config/dirs.lua"
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" "$nvim_dirs" 2>/dev/null
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
printf "return {\n" >> "$nvim_dirs"
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42cd %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"map g%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
printf(\"%s\n\",\$2) >> \"$lf_dirs\" ;
printf(\" %s = '%s',\n\",\$1,\$2) >> \"$nvim_dirs\" }"
printf(\"%s\n\",\$2) >> \"$lf_dirs\" }"
eval "echo \"$(cat "$bmfiles")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
@ -29,4 +26,3 @@ eval "echo \"$(cat "$bmfiles")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$
printf(\"%s\n\",\$2) >> \"$lf_files\" ;
printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"
printf "}" >> "$nvim_dirs"