Skip to content

Help toggling settings #1192

Answered by joelim-work
oredaze asked this question in Q&A
Apr 3, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

To check whether the preview column is enabled you need to use = to compare the strings. Also the string you should compare to is true, not on.

To apply two settings at once, you need to separate them using ;, and also add : at the start (this means an lf command, and is normally implied but needs to be specified if chaining multiple commands using ;).

Here is the modified config:

cmd preview_toggle %{{
  if [ "$lf_preview" = "true" ]; then
    lf -remote "send $id :set preview!; set ratios 1:5"
  else
    lf -remote "send $id :set preview!; set ratios 1:2:3"
  fi
}}
map zp preview_toggle

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@joelim-work
Comment options

@oredaze
Comment options

Answer selected by oredaze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants