From ac40dddfa16348715c15efb9c58395785ab89c23 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Tue, 11 Jul 2023 22:21:36 +0300 Subject: [PATCH] update doc cc #1324 --- doc.go | 4 +++- docstring.go | 4 +++- lf.1 | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc.go b/doc.go index e486818b..c566d8fa 100644 --- a/doc.go +++ b/doc.go @@ -1565,15 +1565,17 @@ There is a special command 'on-cd' that runs a shell command when it is defined You can define it just as you would define any other command: cmd on-cd &{{ + bash -c ' # display git repository status in your prompt source /usr/share/git/completion/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=auto GIT_PS1_SHOWSTASHSTATE=auto GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUPSTREAM=auto - git=$(__git_ps1 " (%s)") || true + git=$(__git_ps1 " (%s)") fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f$git\033[0m" lf -remote "send $id set promptfmt \"$fmt\"" + ' }} If you want to print escape sequences, you may redirect 'printf' output to '/dev/tty'. diff --git a/docstring.go b/docstring.go index 01031a09..c57bcf79 100644 --- a/docstring.go +++ b/docstring.go @@ -1717,15 +1717,17 @@ and the directory is changed. You can define it just as you would define any other command: cmd on-cd &{{ + bash -c ' # display git repository status in your prompt source /usr/share/git/completion/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=auto GIT_PS1_SHOWSTASHSTATE=auto GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUPSTREAM=auto - git=$(__git_ps1 " (%s)") || true + git=$(__git_ps1 " (%s)") fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f$git\033[0m" lf -remote "send $id set promptfmt \"$fmt\"" + ' }} If you want to print escape sequences, you may redirect 'printf' output to diff --git a/lf.1 b/lf.1 index 78c1e54e..32bbedf5 100644 --- a/lf.1 +++ b/lf.1 @@ -1760,15 +1760,17 @@ There is a special command 'on-cd' that runs a shell command when it is defined .PP .EX cmd on-cd &{{ + bash -c ' # display git repository status in your prompt source /usr/share/git/completion/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=auto GIT_PS1_SHOWSTASHSTATE=auto GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUPSTREAM=auto - git=$(__git_ps1 " (%s)") || true + git=$(__git_ps1 " (%s)") fmt="\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f$git\e033[0m" lf -remote "send $id set promptfmt \e"$fmt\e"" + ' }} .EE .PP