Code Monkey home page Code Monkey logo

vim-share-link's Introduction

vim-share-link

This is a Vim plugin that exposes a :CodeBrowserBlobUrl command, optionally taking a visually-selected range of lines. It outputs the URL to your favorite code browsing website (GitHub, or maybe your company's internal repo tool—whatever you may have configured).

Installation

If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone https://github.com/ahw/vim-share-link.git

Usage

Set the code browsing URL template string

let g:vim_share_link_template = "https://www.example.com/repos/<REPOSITORY_NAME>/browse/<PATH_TO_FILE><IFLINES>#<LINE1>-<LINE2></IFLINES>"

The template string includes a number of macros that look kind of like XML tags. Most of these "tags" are void tags, meaning they exist entirely on their own without "stuff" inside. The exception is <IFLINES>, which is detailed below.

Macro Definition
<REPOSITORY_NAME> The name of the repository. This will default to all the non-slash characters before .git in the remote.origin.url name. The exception is GitHub, for which special logic is in place to also parse out the username portion of the repo name so that the link works correctly.
<PATH_TO_FILE> The relative path to a file starting from the repository root.
<IFLINES> Everything between the opening and closing <IFLINES> tag will appear whenever the :CodeBrowserBlobUrl command is run with a visual selection (i.e., '<,'>CodeBrowserBlobUrl).
<LINE1> The smaller line number of the visually-selected range.
<LINE2> The larger line number of the visually-selected range.

Generate the code browser URL

:CodeBrowserBlobUrl

vim-share-link's People

Contributors

ahw avatar

Watchers

James Cloos avatar  avatar  avatar

vim-share-link's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.