Today I Learned

hashrocket A Hashrocket project

Share Highlighted Code

Today I learned a cool trick.

Select a range of code, enter command mode, and type Gbrowse:

:'<,'>Gbrowse

This opens Github in your browser with the range of code highlighted. Github support seems to be standard; I believe you can add other code hosting providers.

Here's a link I made with this command:

https://github.com/hashrocket/hr-til/blob/1bc38b724bb620b1672a9f525a4450f6d4f68b3c/app/controllers/sessions_controller.rb#L15-L18

This also accepts a line number:

:10 Gbrowse
See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.