heraldofsolace / VimHelpBot

VimHelpBot is a bot that replies to r/vim and r/neovim comments with link to Vim Help page
GNU General Public License v3.0
46 stars 2 forks source link
bot praw python3 reddit vim

Build and Deploy to Google Compute Engine

VimHelpBot is a cute little bot which lurks on r/vim and r/neovim as u/vim-help-bot. It looks for comments containing ":h help-topic" and replies with a link to Vim Help.

How it works

It monitors all comments on r/vim r/neovim and uses two regex to extract the help topic. By default it looks for :(h|he|hel|help) topic within backticks and extracts topic. If it fails, it looks for :h and extracts until the first space after that.

It uses a tag database to figure out which helpfile topic belongs to and creates a link to vimhelp for that topic.

If an exact match is not found, it tries to follow Vim's algorithm. From :h E149:

      If there is no full match for the pattern, or there
      are several matches, the "best" match will be used.
      A sophisticated algorithm is used to decide which
      match is better than another one.  These items are
      considered in the computation:
      - A match with same case is much better than a match
        with different case.
      - A match that starts after a non-alphanumeric
        character is better than a match in the middle of a
        word.
      - A match at or near the beginning of the tag is
        better than a match further on.
      - The more alphanumeric characters match, the better.
      - The shorter the length of the match, the better.

If no tag is found for a topic, it automatically creates a github issue.

Donate

If my program helped you, please consider donating -

Donate using Liberapay

ko-fi