Created
February 4, 2025 10:29
-
-
Save acenturyandabit/3e78f9a7150f787b14594881f91a2c79 to your computer and use it in GitHub Desktop.
cfzf: open fzf result with vscode. Also supply a -d argument to be able to change the root directory.
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
cfzf () { | |
( | |
while getopts "d:" opt; do [[ $opt == "d" ]] && d_value="$OPTARG"; done | |
shift $((OPTIND - 1)) | |
if [ -n "$d_value" ]; then cd "$d_value" || exit; fi | |
if [ $# -gt 0 ]; then | |
code $(fzf -q "$*") | |
else | |
code $(fzf) | |
fi | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment