File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 (project-root (project-current ))))))
2828
2929 (defun meain/find-file-git-changed ()
30- " Fuzzy find git changed files."
30+ " Fuzzy find git or jj changed files."
3131 (interactive )
32- (let* ((untracked-files (shell-command-to-string " git ls-files --others --exclude-standard" ))
33- (changed-files (shell-command-to-string " git diff --name-only" ))
34- (files (split-string (concat untracked-files " \n " changed-files) " \n " t )))
35- (find-file (completing-read " Pick file: " files ))))
32+ (let* ((project-root (locate-dominating-file default-directory " .jj" ))
33+ (get-changed-files
34+ (if project-root
35+ ; ; Use jj (use `jj diff --name-only -r 'trunk()..@'` for since trunk)
36+ (lambda ()
37+ (let ((changed (shell-command-to-string " jj diff --name-only -r 'latest(bookmarks() & ::@)..@'" )))
38+ (split-string changed " \n " t )))
39+ ; ; Use git
40+ (lambda ()
41+ (let ((untracked-files (shell-command-to-string " git ls-files --others --exclude-standard" ))
42+ (changed-files (shell-command-to-string " git diff --name-only" )))
43+ (split-string (concat untracked-files " \n " changed-files) " \n " t )))))
44+ (files (funcall get-changed-files)))
45+ (find-file (completing-read " Find git/jj changed file: " files ))))
3646
3747 (defun meain/find-file-semantic ()
3848 (interactive )
You can’t perform that action at this time.
0 commit comments