File tree 4 files changed +33
-4
lines changed
4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change 299
299
; ;; <leader> v --- versioning
300
300
(:prefix-map (" v" . " versioning" )
301
301
:desc " Git revert file" " R" #'vc-revert
302
- :desc " Kill link to remote" " y" #'browse-at-remote-kill
302
+ :desc " Kill link to remote" " y" #'+vc/ browse-at-remote-kill
303
303
:desc " Kill link to homepage" " Y" #'+vc/browse-at-remote-kill-homepage
304
304
(:when (featurep! :ui vc-gutter)
305
305
:desc " Git revert hunk" " r" #'git-gutter:revert-hunk
327
327
:desc " Find issue" " i" #'forge-visit-issue
328
328
:desc " Find pull request" " p" #'forge-visit-pullreq )
329
329
(:prefix (" o" . " open in browser" )
330
- :desc " Browse file or region" " ." #'browse-at-remote
330
+ :desc " Browse file or region" " ." #'+vc/ browse-at-remote
331
331
:desc " Browse homepage" " h" #'+vc/browse-at-remote-homepage
332
332
:desc " Browse remote" " r" #'forge-browse-remote
333
333
:desc " Browse commit" " c" #'forge-browse-commit
Original file line number Diff line number Diff line change 411
411
; ;; <leader> g --- git/version control
412
412
(:prefix-map (" g" . " git" )
413
413
:desc " Revert file" " R" #'vc-revert
414
- :desc " Copy link to remote" " y" #'browse-at-remote-kill
414
+ :desc " Copy link to remote" " y" #'+vc/ browse-at-remote-kill
415
415
:desc " Copy link to homepage" " Y" #'+vc/browse-at-remote-kill-homepage
416
416
(:when (featurep! :ui hydra)
417
417
:desc " SMerge" " m" #'+vc/smerge-hydra/body )
444
444
:desc " Find issue" " i" #'forge-visit-issue
445
445
:desc " Find pull request" " p" #'forge-visit-pullreq )
446
446
(:prefix (" o" . " open in browser" )
447
- :desc " Browse file or region" " o" #'browse-at-remote
447
+ :desc " Browse file or region" " o" #'+vc/ browse-at-remote
448
448
:desc " Browse homepage" " h" #'+vc/browse-at-remote-homepage
449
449
:desc " Browse remote" " r" #'forge-browse-remote
450
450
:desc " Browse commit" " c" #'forge-browse-commit
Original file line number Diff line number Diff line change 5
5
(cdr (browse-at-remote--get-url-from-remote (car url))))
6
6
(user-error " Can't find homepage for current project" )))
7
7
8
+ (defvar browse-at-remote-prefer-symbolic )
9
+ ;;;### autoload
10
+ (defun +vc/browse-at-remote (&optional arg)
11
+ " Open URL to current file (and line if selection is active) in browser.
12
+ If prefix ARG, negate the default value of `browse-at-remote-prefer-symbolic' ."
13
+ (interactive " P" )
14
+ (let ((browse-at-remote-prefer-symbolic
15
+ (if arg
16
+ (not browse-at-remote-prefer-symbolic)
17
+ browse-at-remote-prefer-symbolic)))
18
+ (browse-at-remote)))
19
+
20
+ ;;;### autoload
21
+ (defun +vc/browse-at-remote-kill (&optional arg)
22
+ " Copy URL to current file (and line if selection is active) to clipboard.
23
+ If prefix ARG, negate the default value of `browse-at-remote-prefer-symbolic' ."
24
+ (interactive " P" )
25
+ (let ((browse-at-remote-prefer-symbolic
26
+ (if arg
27
+ (not browse-at-remote-prefer-symbolic)
28
+ browse-at-remote-prefer-symbolic)))
29
+ (browse-at-remote-kill)))
30
+
8
31
;;;### autoload
9
32
(defun +vc/browse-at-remote-homepage ()
10
33
" Open homepage for current project in browser."
Original file line number Diff line number Diff line change @@ -100,7 +100,13 @@ otherwise in default state."
100
100
101
101
102
102
(after! browse-at-remote
103
+ ; ; It's more sensible that the user have more options. If they want line
104
+ ; ; numbers, users can request them by making a selection first. Otherwise
105
+ ; ; omitting them.
103
106
(setq browse-at-remote-add-line-number-if-no-region-selected nil )
107
+ ; ; Opt to produce permanent links with `browse-at-remote' by default,
108
+ ; ; using commit hashes rather than branch names.
109
+ (setq browse-at-remote-prefer-symbolic nil )
104
110
105
111
; ; HACK `browse-at-remote' produces urls with `nil' in them, when the repo is
106
112
; ; detached. This creates broken links. I think it is more sensible to
You can’t perform that action at this time.
0 commit comments