Skip to content

Commit c194e37

Browse files
committed
feat: wf, function to find & edit files
1 parent e0652f5 commit c194e37

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

home/.zshrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ add-zsh-hook chpwd print_readme
6060
# example. Works with Tab completion.
6161
alias rr='git rev-parse --show-toplevel 2>/dev/null || pwd'
6262

63+
wf() {
64+
# "`w`here `f`ile": which files contain the given regex?
65+
local editor=${EDITOR:-vim}
66+
# `--open-tty` for https://unix.stackexchange.com/a/732101
67+
rg --files-with-matches "$1" | fzf | xargs --no-run-if-empty --open-tty "$editor"
68+
}
69+
6370
pullall() {
6471
gh auth status 1>/dev/null 2>&1 || gh auth login
6572

0 commit comments

Comments
 (0)