diff --git a/doc.go b/doc.go index 3be071d..7d4f912 100644 --- a/doc.go +++ b/doc.go @@ -1149,6 +1149,14 @@ Besides, it is also important that the application is processing the file on the This is especially relevant for big files. lf automatically closes the previewer script output pipe with a SIGPIPE when enough lines are read. When everything else fails, you can make use of the height argument to only feed the first portion of the file to a program for preview. +Note that some programs may not respond well to SIGPIPE to exit with a non-zero return code and avoid caching. +You may trap SIGPIPE in your preview script to avoid error propogation: + + #!/bin/sh + + trap "" PIPE + + ... You may also use an existing preview filter as you like. Your system may already come with a preview filter named 'lesspipe'. diff --git a/docstring.go b/docstring.go index 2f9cef2..64b5540 100644 --- a/docstring.go +++ b/docstring.go @@ -1286,7 +1286,16 @@ reading it to the memory and then do the processing afterwards. This is especially relevant for big files. lf automatically closes the previewer script output pipe with a SIGPIPE when enough lines are read. When everything else fails, you can make use of the height argument to only feed -the first portion of the file to a program for preview. +the first portion of the file to a program for preview. Note that some +programs may not respond well to SIGPIPE to exit with a non-zero return code +and avoid caching. You may trap SIGPIPE in your preview script to avoid +error propogation: + + #!/bin/sh + + trap "" PIPE + + ... You may also use an existing preview filter as you like. Your system may already come with a preview filter named 'lesspipe'. These filters may have diff --git a/lf.1 b/lf.1 index fb196da..6b2c0e2 100644 --- a/lf.1 +++ b/lf.1 @@ -1267,7 +1267,19 @@ Since this script is called for each file selection change it needs to be as eff esac .EE .PP -Another important consideration for efficiency is the use of programs with short startup times for preview. For this reason, 'highlight' is recommended over 'pygmentize' for syntax highlighting. Besides, it is also important that the application is processing the file on the fly rather than first reading it to the memory and then do the processing afterwards. This is especially relevant for big files. lf automatically closes the previewer script output pipe with a SIGPIPE when enough lines are read. When everything else fails, you can make use of the height argument to only feed the first portion of the file to a program for preview. +Another important consideration for efficiency is the use of programs with short startup times for preview. For this reason, 'highlight' is recommended over 'pygmentize' for syntax highlighting. Besides, it is also important that the application is processing the file on the fly rather than first reading it to the memory and then do the processing afterwards. This is especially relevant for big files. lf automatically closes the previewer script output pipe with a SIGPIPE when enough lines are read. When everything else fails, you can make use of the height argument to only feed the first portion of the file to a program for preview. Note that some programs may not respond well to SIGPIPE to exit with a non-zero return code and avoid caching. You may trap SIGPIPE in your preview script to avoid error propogation: +.PP +.EX + #!/bin/sh +.EE +.PP +.EX + trap "" PIPE +.EE +.PP +.EX + ... +.EE .PP You may also use an existing preview filter as you like. Your system may already come with a preview filter named 'lesspipe'. These filters may have a mechanism to add user customizations as well. See the related documentations for more information. .SH CHANGING DIRECTORY