1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Open File On Remote Like GitHub as a VSCode TIL

This commit is contained in:
jbranchaud
2025-11-03 14:19:14 -05:00
parent eb4dea611e
commit 9e76753540
2 changed files with 26 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1679 TILs and counting..._
_1680 TILs and counting..._
See some of the other learning resources I work on:
@@ -1909,6 +1909,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Find The Location Of User Settings JSON File](vscode/find-the-location-of-user-settings-json-file.md)
- [Jump To Problems In The Current File](vscode/jump-to-problems-in-the-current-file.md)
- [Open An Integrated Terminal Window](vscode/open-an-integrated-terminal-window.md)
- [Open File On Remote Like GitHub](vscode/open-file-on-remote-like-github.md)
- [Pop Open The Quick Fix Window](vscode/pop-open-the-quick-fix-window.md)
- [Step Through Project-Wide Search Results](vscode/step-through-project-wide-search-results.md)
- [Synchronize Vim Clipboard With System Clipboard](vscode/synchronize-vim-clipboard-with-system-clipboard.md)

View File

@@ -0,0 +1,24 @@
# Open File On Remote Like GitHub
One of my favorite `vim-fugitive` features is being able to run the `:GBrowse`
command to open the current file or current selection of lines to GitHub in the
browser. This is useful for getting a shareable URL or even just being a
starting point for browsing the codebase from GitHub.
VSCode (as well as Cursor) supports this functionality as well. There are a
couple ways to do it.
First, from the File Browser sidebar you can right click on a particular file or
directory. Find the _Open on Remote (Web)_ submenu. From there select _Open File
on Remote_. That will open the file in GitHub with the focused line highlighted
(or will open to that directory, as the case may be).
Alternatively, you can right click in the file editor and follow the exact same
steps as described above.
If you're wanting a permalink to the remote that highlights a selection of
lines, you can highlight that section of lines and right-click the selected
lines and again follow the steps above.
If your remote is some other host like BitBucket, it will recognize that from
your project's gitconfig and open to that instead of GitHub.