Troubleshoot - gokcehan/lf GitHub Wiki
Logging can be enabled for both the lf client and server using the -log option, which can be used to help troubleshoot errors.
lf client:
lf -log /path/to/lf.log
lf server:
lf -server -log /path/to/lf_server.log
If lf crashes, it will not restore the terminal settings, resulting in the printed stack trace being difficult to read. Since the stack trace is printed to stderr, it can be useful to redirect this to a file first:
lf 2> /path/to/lf.err
The values of each option are exported as environment variables in the form lf_<option>. These can be displayed using the following command:
$env | grep ^lf_ | sort | $PAGER
This can also be saved as a command in the config file:
cmd settings ${{
env | grep ^lf_ | sort | $PAGER
}}
You may enable legacy console in command prompt options.
See https://github.com/gokcehan/lf/issues/644
Change open command to
cmd open &{{
mimetype=$(file --brief --dereference --mime-type $f)
defapp=$(xdg-mime query default $mimetype)
case "$defapp" in
nvim.desktop)
lf -remote "send $id \$nvim $f"
;;
vim.desktop)
lf -remote "send $id \$vim $f"
;;
*)
xdg-open $f
esac
}}
The error message running shell: exit status ... means you ran a shell command (e.g. $false) but it returned something other than 0 and hence did not run successfully. This should be resolved by fixing the issue with the command itself to ensure that it runs successfully.
However this is not always possible, and as an alternative you can suppress the failure so that lf doesn't report it. For example, to ignore errors when opening files using nvim:
cmd open $nvim "$f" || true
Many terminal emulators send the same terminal sequence when pressing ctrl+i or tab, which means programs like lf cannot distinguish between the two inputs. There are various other key combinations that cannot be distinguished, ctrl+i/tab is just one such example.
It is possible to check what key event is received by just pressing a key combination - if it is not bound to an action then an error message saying unknown mapping ... will show up.
On Windows, the default interpreter for shell commands is Windows CMD, which doesn't support multiline commands. So the following definition won't work:
cmd foobar !{{
echo foo
echo bar
}}
One workaround is to save the commands into a batch script, and then invoke it from lf:
foobar.bat:
@echo off
echo foo
echo barlfrc:
cmd foobar !foobar.bat
An alternative solution is to use a more modern shell like PowerShell instead of CMD:
set shell pwsh
cmd foobar !{{
echo foo
echo bar
}}