Add xref-find-references-other-window

This commit is contained in:
David Morgan 2022-06-15 12:32:55 +01:00
parent f3d0b2a1b6
commit 75fb2d87b3
1 changed files with 7 additions and 1 deletions

View File

@ -193,10 +193,16 @@ and file 'filename' will be opened and cursor set on line 'linenumber'"
(use-package xref
:ensure nil
:config
(defun xref-find-references-other-window (identifier)
"Like `xref-find-references' but switch to the other window"
(interactive (list (xref--read-identifier "Find references of: ")))
(xref--find-xrefs identifier 'references identifier 'window))
(define-key ctl-x-4-map (kbd "M-?") 'xref-find-references-other-window)
;; 'xref-prompt-for-identifier begins with not, so adding this prevents
;; prompting for an identifier when calling xref-find-references, unless
;; there is no value at point that can be used
(add-to-list 'xref-prompt-for-identifier 'xref-find-references t))
(add-to-list 'xref-prompt-for-identifier 'xref-find-references t)
(add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-window t))
(provide 'init-editor)
;;; init-editor.el ends here