fix default promptfmt to use %d instead of %w

cc #545
This commit is contained in:
Gokcehan 2021-01-11 00:40:14 +03:00
parent 07d42c9a80
commit 2e4ed8f867
4 changed files with 10 additions and 10 deletions

6
doc.go
View File

@ -119,7 +119,7 @@ The following options can be used to customize the behavior of lf:
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '') cleaner string (default '')
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
@ -604,7 +604,7 @@ The file should be executable.
One argument is passed to the file; the path to the file whose preview should be cleaned. One argument is passed to the file; the path to the file whose preview should be cleaned.
Preview clearing is disabled when the value of this option is left empty. Preview clearing is disabled when the value of this option is left empty.
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%w/\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d/\033[0m\033[1m%f\033[0m")
Format string of the prompt shown in the top line. Format string of the prompt shown in the top line.
Special expansions are provided, '%u' as the user name, '%h' as the host name, '%w' as the working directory, and '%f' as the file name. Special expansions are provided, '%u' as the user name, '%h' as the host name, '%w' as the working directory, and '%f' as the file name.
@ -1172,7 +1172,7 @@ You can define it just as you would define any other command:
GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUNTRACKEDFILES=auto
GIT_PS1_SHOWUPSTREAM=auto GIT_PS1_SHOWUPSTREAM=auto
git=$(__git_ps1 " (%s)") || true git=$(__git_ps1 " (%s)") || true
fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[1m%f$git\033[0m" 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\"" lf -remote "send $id set promptfmt \"$fmt\""
}} }}

View File

@ -122,7 +122,7 @@ The following options can be used to customize the behavior of lf:
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '') cleaner string (default '')
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
@ -642,7 +642,7 @@ preview cache disabled. The file should be executable. One argument is
passed to the file; the path to the file whose preview should be cleaned. passed to the file; the path to the file whose preview should be cleaned.
Preview clearing is disabled when the value of this option is left empty. Preview clearing is disabled when the value of this option is left empty.
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%w/\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d/\033[0m\033[1m%f\033[0m")
Format string of the prompt shown in the top line. Special expansions are Format string of the prompt shown in the top line. Special expansions are
provided, '%u' as the user name, '%h' as the host name, '%w' as the working provided, '%u' as the user name, '%h' as the host name, '%w' as the working
@ -1314,7 +1314,7 @@ define any other command:
GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUNTRACKEDFILES=auto
GIT_PS1_SHOWUPSTREAM=auto GIT_PS1_SHOWUPSTREAM=auto
git=$(__git_ps1 " (%s)") || true git=$(__git_ps1 " (%s)") || true
fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[1m%f$git\033[0m" 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\"" lf -remote "send $id set promptfmt \"$fmt\""
}} }}

6
lf.1
View File

@ -133,7 +133,7 @@ The following options can be used to customize the behavior of lf:
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '') cleaner string (default '')
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%w\e033[0m\e033[1m%f\e033[0m") promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
@ -722,7 +722,7 @@ Set the path of a previewer file to filter the content of regular files for prev
Set the path of a cleaner file. This file will be called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. The file should be executable. One argument is passed to the file; the path to the file whose preview should be cleaned. Preview clearing is disabled when the value of this option is left empty. Set the path of a cleaner file. This file will be called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. The file should be executable. One argument is passed to the file; the path to the file whose preview should be cleaned. Preview clearing is disabled when the value of this option is left empty.
.PP .PP
.EX .EX
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%w/\e033[0m\e033[1m%f\e033[0m") promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d/\e033[0m\e033[1m%f\e033[0m")
.EE .EE
.PP .PP
Format string of the prompt shown in the top line. Special expansions are provided, '%u' as the user name, '%h' as the host name, '%w' as the working directory, and '%f' as the file name. Home folder is shown as '~' in the working directory expansion. Directory names are automatically shortened to a single character starting from the left most parent when the prompt does not fit to the screen. Format string of the prompt shown in the top line. Special expansions are provided, '%u' as the user name, '%h' as the host name, '%w' as the working directory, and '%f' as the file name. Home folder is shown as '~' in the working directory expansion. Directory names are automatically shortened to a single character starting from the left most parent when the prompt does not fit to the screen.
@ -1284,7 +1284,7 @@ There is a special command 'on-cd' that runs a shell command when it is defined
GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUNTRACKEDFILES=auto
GIT_PS1_SHOWUPSTREAM=auto GIT_PS1_SHOWUPSTREAM=auto
git=$(__git_ps1 " (%s)") || true git=$(__git_ps1 " (%s)") || true
fmt="\e033[32;1m%u@%h\e033[0m:\e033[34;1m%w\e033[0m\e033[1m%f$git\e033[0m" 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"" lf -remote "send $id set promptfmt \e"$fmt\e""
}} }}
.EE .EE

View File

@ -91,7 +91,7 @@ func init() {
gOpts.ifs = "" gOpts.ifs = ""
gOpts.previewer = "" gOpts.previewer = ""
gOpts.cleaner = "" gOpts.cleaner = ""
gOpts.promptfmt = "\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[1m%f\033[0m" gOpts.promptfmt = "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"
gOpts.shell = gDefaultShell gOpts.shell = gDefaultShell
gOpts.timefmt = time.ANSIC gOpts.timefmt = time.ANSIC
gOpts.truncatechar = "~" gOpts.truncatechar = "~"