Code Monkey home page Code Monkey logo

vim-github-link's Introduction

vim-github-link

Copy github/gitlab link for current line(s) to clipboard.

Links have the format:

  • GitHub - https://GITHUB_REMOTE_DOMAIN/OWNER/REPO/blob/$REF/PATH/TO/FILE#L1-L10.
  • GitLab - https://GITLAB_REMOTE_DOMAIN/OWNER/REPO/blob/$REF/PATH/TO/FILE#L1-10.

The plugin defines the following functions which returns different $REF references:

  • GetCommitLink: commit which most recently modified the current file (permalink)
  • GetCurrentBranchLink: active branch name
  • GetCurrentCommitLink: most recent commit - URL will 404 if you haven't pushed it to the remote

Usage

In normal mode

:1,3GetCurrentBranchLink

then link is copied to your clipboard.

In visual mode, same command after selected.

Install

dein.vim

add below line into .vimrc

call dein#add('knsh14/vim-github-link')

or add to toml file

[[plugins]]
repo = 'knsh14/vim-github-link'

vim-plug

Plug 'knsh14/vim-github-link'

vim-github-link's People

Contributors

knsh14 avatar lehmacdj avatar mogelbrod avatar omertuc avatar robertgzr avatar schumi543 avatar shore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vim-github-link's Issues

letter 's' are removed from result link

For example, when I pick a link from some code, I expect this one:

https://github.com/antirez/redis/blob/unstable/src/db.c#L1483-L1487

but actually I got:

http://github.com/antirez/redi/blob/untable/rc/db.c#L1483-L1487

All letter 's' are removed.

I guess there is something wrong in this line

https://github.com/knsh14/vim-github-link/blob/master/plugin/github-link.vim#L44

This is the VIM I use:

:ve
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 06 2019 03:41:10)
Included patches: 1-875, 878, 884, 948
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +clientserver      +diff              +folding           +libcall           +mouse_gpm         +packages          +ruby              +termguicolors     +virtualedit       +xpm
+arabic            +clipboard         +digraphs          -footer            +linebreak         -mouse_jsbterm     +path_extra        +scrollbind        +terminal          +visual            +xsmp_interact
+autocmd           +cmdline_compl     +dnd               +fork()            +lispindent        +mouse_netterm     +perl              +signs             +terminfo          +visualextra       +xterm_clipboard
+autochdir         +cmdline_hist      -ebcdic            +gettext           +listcmds          +mouse_sgr         +persistent_undo   +smartindent       +termresponse      +viminfo           -xterm_save
-autoservername    +cmdline_info      +emacs_tags        -hangul_input      +localmap          -mouse_sysmouse    +postscript        +startuptime       +textobjects       +vreplace
+balloon_eval      +comments          +eval              +iconv             +lua               +mouse_urxvt       +printer           +statusline        +textprop          +wildignore
+balloon_eval_term +conceal           +ex_extra          +insert_expand     +menu              +mouse_xterm       +profile           -sun_workshop      +timers            +wildmenu
+browse            +cryptv            +extra_search      +job               +mksession         +multi_byte        -python            +syntax            +title             +windows
++builtin_terms    +cscope            +farsi             +jumplist          +modify_fname      +multi_lang        +python3           +tag_binary        +toolbar           +writebackup
+byte_offset       +cursorbind        +file_in_path      +keymap            +mouse             -mzscheme          +quickfix          +tag_old_static    +user_commands     +X11
+channel           +cursorshape       +find_in_path      +lambda            +mouseshape        +netbeans_intg     +reltime           -tag_any_white     +vartabs           -xfontset
+cindent           +dialog_con_gui    +float             +langmap           +mouse_dec         +num64             +rightleft         +tcl               +vertsplit         +xim
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1
.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/in
clude/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/i
nclude/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-iWd92G/vim-8.1.0875=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D
_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-
gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-prot
ector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -L/us
r/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm
Press ENTER or type command to continue

not only github.com

now this plugin can use github.com only.
need to use repos hosted other services.
if #1 is finished, this will be easy task.

Incorrect remote repository when used with 2 distinct remotes

Description

I have configured my repository to have 2 remotes.

$ git remote -v
origin	[email protected]:STEllAR-GROUP/hpx.git (fetch)
origin	[email protected]:STEllAR-GROUP/hpx.git (push)
satacker	[email protected]:SAtacker/hpx.git (fetch)
satacker	[email protected]:SAtacker/hpx.git (push)

However I get the following link when I am checked out on a branch tracking satacker remote and not origin.
image
Using all the Get* commands I am not getting the expected link.

Link I get - https://github.com/STEllAR-GROUP/hpx/blob/38f850e99cba5a3f65555d02c39aa3c1479c1914/examples/1d_stencil/1d_stencil_4_parallel_any_sender.cpp#L157-L199

Link I expect: https://github.com/SAtacker/hpx/blob/38f850e99cba5a3f65555d02c39aa3c1479c1914/examples/1d_stencil/1d_stencil_4_parallel_any_sender.cpp#L157-L199

Thanks for this plugin!

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.