Skip to content

Migrating from LF #848

Closed Locked Answered by sxyazi
idr4n asked this question in Q&A
Mar 29, 2024 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

I think you can do it like this:

[[manager.prepend_keymap]]
on   = [ "i" ]
run  = '''
shell --block --confirm '
    path="$1"
    file_tags="$HOME/Sync/file_tags.txt"

    # check if file_tags exists
    if [ ! -f $file_tags ]; then
        touch $file_tags
    fi

    # replace $HOME with ~ from the start of path
    path="${path/#$HOME/~}"

    if rg -q "^$path\$" $file_tags; then
        echo "Path already present."
    else
        # append the path to the file name and save it in the "file_tags" file
        echo "$path" >> $file_tags
    fi
'
'''

But this isn't very ergonomic, I would recommend implementing it through a plugin, if you need to hide Yazi and activate fzf, you can achi…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@idr4n
Comment options

Comment options

You must be logged in to vote
3 replies
@idr4n
Comment options

@sxyazi
Comment options

@idr4n
Comment options

Answer selected by idr4n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants