Skip to content

Jump to first file #1398

Closed Answered by joelim-work
limaceous-bushwhacker asked this question in Q&A
Discussion options

You must be logged in to vote

There's no builtin command for this kind of movement, but assuming you have directories sorted above files this is a hacky solution:

map gf :set dironly true; bottom; set dironly false; down

Another alternative that is more flexible is to use the shell to determine the first file, and then call lf -remote to select it:

map gf %{{
    # replace this with any other method of getting a file
    file=$(ls -F | grep -v '[*/=>@|]$' | head -n 1)

    if [ -f "$file" ]; then
        lf -remote "send $id select \"$file\""
    fi
}}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by limaceous-bushwhacker
Comment options

You must be logged in to vote
0 replies
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