Skip to content

Instantly share code, notes, and snippets.

@ranyitz
Last active November 15, 2019 02:17
Show Gist options
  • Save ranyitz/f15aaecd0ac6f1f7a87a3910c08d1adc to your computer and use it in GitHub Desktop.
Save ranyitz/f15aaecd0ac6f1f7a87a3910c08d1adc to your computer and use it in GitHub Desktop.
CLI equivalent to the `t` command in GitHub that opens the file finder
function t() {
FILES=($(rg --files --hidden --glob '!.git' | fzf --exit-0 --reverse --multi))
[[ $FILES ]] && code $FILES --folder-uri=$(git rev-parse --show-toplevel)
}
@ranyitz
Copy link
Author

ranyitz commented Nov 14, 2019

fuzzy file finder that opens vscode

CLI equivalent to the t command in GitHub that opens the file finder

t-cli

Features

  • Search through hidden files but ignores .git directory
  • Ignore files specified in .gitignore
  • Support opening multiple files (using <tab>)
  • Open vscode root on the git project root

Prerequisites

Note: I'm using vscode on mac, but you can generalize the script using your own editor and install fzf/ripgrep for your own os

brew install fzf
brew install ripgrep

Installation

Paste this function in your .zshrc/.bashrc file

Inspiration

t keyboard shortcut on github docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment