Skip to content

Additional border for the list section #4148

@junegunn

Description

@junegunn

Summary

  • Add --list-border option to draw additional border around the list section
  • Also add --list-label and --list-label-pos, similar to --border-label and --border-label-pos, for placing label on the inner border

Objective

  • Provide greater flexibility for UI customization

Examples

git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border --list-label ' Result ' --preview-label ' Preview '
image
git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border \
    --bind 'result:transform-list-label:
        if [[ -z $FZF_QUERY ]]; then
          echo " $FZF_MATCH_COUNT items "
        else
          echo " $FZF_MATCH_COUNT matches for [$FZF_QUERY] "
        fi
        ' \
    --bind 'focus:transform-preview-label:[[ -n {} ]] && printf " Previewing [%s] " {}' \
    --bind 'ctrl-r:change-list-label( Reloading the list )+reload(sleep 2; git ls-files)' \
    --color 'list-border:#669966,list-label:#99cc99,preview-border:#9999cc,preview-label:#ccccff' \
    --border --border-label ' Demo ' --padding 1,2
image
git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border thinblock --preview-window border-thinblock \
    --list-label-pos bottom --preview-label-pos bottom \
    --bind 'result:transform-list-label:
        if [[ -z $FZF_QUERY ]]; then
          echo " $FZF_MATCH_COUNT items "
        else
          echo " $FZF_MATCH_COUNT matches for [$FZF_QUERY] "
        fi
        ' \
    --bind 'focus:transform-preview-label:[[ -n {} ]] && printf " Previewing [%s] " {}' \
    --bind 'ctrl-r:change-list-label( Reloading the list )+reload(sleep 2; git ls-files)' \
    --color 'bg:#222222,border:#333333,list-bg:#334433,preview-bg:#333344,list-border:#669966,list-label:#99cc99,preview-border:#9999cc,preview-label:#ccccff' \
    --border thinblock --border-label ' Demo ' --border-label-pos bottom --padding 1,2
image

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions