Make the :doc command work even if lf is not in the PATH, add lf environment variable
#1176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes
lfexport a new environment variable namedlfwith the path to thelfbinary. So, scripts can use$lfinstead oflfand work even inlfis not in the path.The
:doccommand now executes$lf -doc(or%lf% -docon Windows) instead oflf -doc. I'd appreciate it if somebody could double-check that this works on Windows.If Go fails to find a path to the lf binary,
$lfis set to the stringlfso that it still works iflfis in the PATH. (Though, from looking at the source briefly, Go might already look in the path if it couldn't find the binary normally)Before this change,
:docdid not work iflfis not in the PATH. This is likely to be a problem for new users who are trying outlfand need docs the most.Moreover, if a developer makes some changes to the docs and runs
lfwithgo run .,:docwould previously return the docs for the version oflfin the PATH (if any) instead of what is expected.Another motivation for this is to make adding command-line options like
lf -buffers(see #1152 (comment)) orlf -marks, if we decide it's a good idea in the future, work regardless of whether lf is in the PATH.