Skip to content

Commit

Permalink
feat: wf, function to find & edit files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpovel committed Mar 6, 2024
1 parent e0652f5 commit c194e37
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions home/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ add-zsh-hook chpwd print_readme
# example. Works with Tab completion.
alias rr='git rev-parse --show-toplevel 2>/dev/null || pwd'

wf() {
# "`w`here `f`ile": which files contain the given regex?
local editor=${EDITOR:-vim}
# `--open-tty` for https://unix.stackexchange.com/a/732101
rg --files-with-matches "$1" | fzf | xargs --no-run-if-empty --open-tty "$editor"
}

pullall() {
gh auth status 1>/dev/null 2>&1 || gh auth login

Expand Down

0 comments on commit c194e37

Please sign in to comment.