Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You can now use v with fzf #23

Open
pkrumins opened this issue Dec 28, 2019 · 0 comments
Open

You can now use v with fzf #23

pkrumins opened this issue Dec 28, 2019 · 0 comments

Comments

@pkrumins
Copy link

pkrumins commented Dec 28, 2019

I made v work with fzf. First, modify v not to display the choice dialog when using the -l flag, then use this shell function to call it:

v() {
    if [[ -z "$@" ]]; then
        local -r choice="$(command v -l 2>&1 | fzf +s --tac --height 15 --reverse | sed -r 's/^[0-9,. \t]*//')"
        if [[ ! -z "$choice" ]]; then
            local -r file="${choice/#~/$HOME}"
            vim "$file"
        fi
    else
        command v "$@"
    fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant