Last active
May 8, 2024 11:07
-
-
Save gabydd/570f0dd5f71dda35241500c18f5d27e3 to your computer and use it in GitHub Desktop.
helix lf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[keys.normal] | |
C-f = [":new", ":insert-output lf-pick", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":buffer-close!", ":theme nord", ":theme default"] | |
# replace the default after theme with the theme you use | |
# open 1 with the open command (l and <left> to open) or more with (<space> to select) then quit | |
# all opened files will be opened in helix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# touch ~/.local/bin/lf-pick | |
# chmod +x ~/.local/bin/lf-pick | |
function lfp(){ | |
local TEMP=$(mktemp) | |
lf -selection-path=$TEMP | |
echo >> $TEMP | |
while read -r line | |
do | |
echo "$line" | |
done < "$TEMP" | |
} | |
lfp |
[keys.normal]
C-f = [":new", ":insert-output lf -selection-path=/dev/stdout", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":buffer-close!", ":redraw"]
Thank you for this.
The best version of this I've found so far (from scratching around in all the various answers), is:
C-f = [":new", ":insert-output lf -print-selection", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":buffer-close!", ":redraw"]
With no lf-pick
script needed.
It almost works too! But you need to have modified a buffer to get it to open, and it doesn't open from the current location, which is a pain.
I think it's a testament to how much helix needs this functionality that we're all scrabbling around in here, trying desperately to make something work...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lf -print-selection
works also. Additionally instead of theme switching:redraw
solves UI re-rendering.