Skip to content

stsewd/gx-extended.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gx-extended.vim

CI

Extend gx to use it beyond just URLs!

Note: this plugin is still under development a lot of things may change!

Features

  • Open anything under your cursor with several handlers per file type
  • Normal and visual mode support
  • Handlers that work together across all file types
  • Fall back to the original gx command if all handlers fail
  • Implement your own handlers

Installation

Install using vim-plug. Put this in your init.vim/.vimrc.

Plug 'stsewd/gx-extended.vim'

Usage

Press gx on normal or visual mode, the text under the cursor or the selected text will be handled by a handler.

See :h gx-extended for more information about settings and how to write your own handler.

Handlers

Handlers with the global file type work across all file types.

global#urls

Opens links with/without an explicit protocol. Examples:

  • A cursor under google.com will open https://google.com

global#gx

Mimics the original gx command.

gitcommit#github

Opens an issue/PR from a git commit message. Examples:

  • A cursor under Fixes #23 will open https://github.com/user/repo/issues/23

Note:

You need to have installed hub (recommended), or tpope/vim-fugitive.

markdown#link

Opens Markdown links. Examples:

  • A cursor under [link](https://google.com) will open https://google.com

Note:

If you have plasticboy/vim-markdown installed (it's included in sheerun/vim-polyglot) you'll need to disable the default key mappings, since that plugin remaps gx by default.

vim#plugin

Opens the GitHub page of the plugin under the cursor. Examples:

  • A cursor under Plug stsewd/fzf-checkout.vim will open https://github.com/stsewd/fzf-checkout.vim

TODO

  • ReStructuredText?
  • requirements.txt?
  • Write more tests