Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save acenturyandabit/3e78f9a7150f787b14594881f91a2c79 to your computer and use it in GitHub Desktop.
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.
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