diff options
author | Vincent Ambo <mail@tazj.in> | 2020-08-23T23·42+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-08-23T23·47+0000 |
commit | 35b214ae9f8f4eaf4e3f0fd22165184f05e219fe (patch) | |
tree | 839f165f0e4350f14c12b7d9385f14b64e889a59 /users/tazjin/emacs/config/functions.el | |
parent | 937469509bfcef494ae1b1bc6ba23bfccd28d477 (diff) |
feat(tazjin/emacs): Add magit-find-file-worktree function r/1708
This will look up a file in the current worktree of the git repository enclosing `default-directory'. In combination with project-find-file this lets me toggle between switching to a file within a project, and within the whole depot. Change-Id: Ie1011f10051fc2c4bd4279b0944a79c7edf92f3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/1838 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/emacs/config/functions.el')
-rw-r--r-- | users/tazjin/emacs/config/functions.el | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index df5b1c1239f0..d4d0c0d603e0 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -289,4 +289,11 @@ (add-to-list 'project-find-functions #'find-depot-project) +(defun magit-find-file-worktree () + (interactive) + "Find a file in the current (ma)git worktree." + (magit-find-file--internal "{worktree}" + (magit-read-file-from-rev "HEAD" "Find file") + #'pop-to-buffer-same-window)) + (provide 'functions) |