Giter Site home page Giter Site logo

god.vim's Introduction

GOD.vim

Get online doc link directly in Vim


This plugin helps you to help people!

You are writing something about Vim on a site which handles markdown language (like vi.se or /r/vim or even a github Readme file like this one) and you want to direct your readers to a page of Vim doc?

Simply use the command :GOD {help-topic} to get in your clipboard a markdown string allowing you to link to the http://vimhelp.appspot.com/ online help.

Examples

Link to one help topic

Give a single argument to the GOD command like this:

:GOD holy-grail

This will put in your clipboard the following string:

[`:h holy-grail`](http://vimhelp.appspot.com/index.txt.html#holy%2dgrail)

Which will appears like this for your readers:

:h holy-grail

Link to a list of help topics

Give several arguments to the GOD command like this:

:GOD help func-range /\~ g^

This will put a markdown formatted list in your clipboard like this one:

 - [`:h help`](http://vimhelp.appspot.com/helphelp.txt.html#help)
 - [`:h :func-range`](http://vimhelp.appspot.com/eval.txt.html#%3afunc%2drange)
 - [`:h /\~`](http://vimhelp.appspot.com/pattern.txt.html#%2f%5c%7e)
 - [`:h g^`](http://vimhelp.appspot.com/motion.txt.html#g%5e)

Which will appears like this for your readers:

Configuration

GOD.vim provides two variables that you can define in your vimrc:

Disable the plugin

To disable the plugin you can put the following line in your vimrc:

let g:loaded_god_vim = 1

Automatically close the help buffer

When you use the :GOD command, the corresponding help buffer will be open. If you don't want to see it, you can add the following line to your vimrc:

let g:god_close_help_buffer = 1

GOD.vim? What's this name?

It actually stands for Get Online Doc :)

Thanks

I'd like to thanks Carpetsmoker who helped me improve the encoding of the generated urls.

This plugin was inspired by this question on the site vi.stackexchange.com: How can I quickly convert a Vim help tag to a vimhelp.appspot.com link?

god.vim's People

Contributors

statox avatar luchermitte avatar

Stargazers

Rich avatar D. Ben Knoble avatar nobe4 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

luchermitte

god.vim's Issues

Improve the handling of the clipboard register

Depending on the user's system and config, sometimes GetOnlineDoc() will fail when trying to assign the link to the clipboard register (I have the problem with WSL for example).

Also using setreg() instead of let @* would probably be better.

See what can be done about that.

Create a function which formats what is copied from the help file

When I copy some text from a help topic, the formatting is often messed up: some hidden signs appear (|, *, <, ...) and it is rendered as plain text.

It would be nice to have a visual mode mapping which allows to select the help text I want to copy and format it as real markdown.

Move functions to autoload

The function are not particularly heavy but moving them to the autoload directory would be a best practice

Tildes in s:URLEncode

I haven't actually tested this, so apologies if I'm reading the code wrong, but the character class (or "collection") in your regexp doesn't appear to include the tilde: ~.

~ is an "unreserved character" in URIs and so, according to the RFC,

percent-encoded octet[...] tilde (%7E) should not be created by URI producers.

It doesn't actually affect the functioning of the plugin in any way I'm aware of, other than making the small number of links which contain a tilde (e.g. :help g~) very slightly less readable, but I thought you might like to add it nonetheless.

Cheers!

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.