Skip to content

dgfitch/vim-mediawiki-editor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-mediawiki-editor

Edit MediaWiki articles from the comfort of Vim, your favorite text editor!

Installation

vim-mediawiki-editor requires Vim compiled with python support and the python mwclient library.

You likely have Python support, but you can check with vim --version | grep +python. MacVim comes with Python support.

If you get an error, try pip install mwclient to get the library.

Once you have these, use your favorite Vim plugin manager to install aquach/vim-mediawiki-editor, or copy plugin and doc into your .vim folder.

I recommend pairing this plugin with mediawiki.vim for syntax highlighting and with goyo.vim for WriteRoom-esque editing.

Usage

Mappings

vim-mediawiki-editor has a few default bindings. They should probably change to something smarter.

gf navigates to the wikilink under your cursor.

C-w f opens the wikilink under your cursor in a new window.

gl opens the backlinks for the wikilink under your cursor.

g. opens the backlinks for the article you are on.

Commands

vim-mediawiki-editor offers these commands:

:MWRead

Loads the given article into a new buffer.

:MWRead Radish

:MWMove or :MWMoveNoRedirect

MWMove does a normal move with redirect.

MWMoveNoRedirect renames the page with no redirect.

:MWBacklinks [article-name]

Opens a list of things that link to the given article, which you can gf, C-w f, or hit Enter on to open.

:MWWrite [article-name]

Writes the article back to the site. If you don't specify an article name, it defaults to the article you opened with :MWRead. After prompting you for the edit summary and major/minor edit, it will publish your work back to the site.

:MWDiff [article-name]

Diffs the current buffer against the hosted version of the article specified on the site. If you don't specify an article name, it defaults to the article you currently have open with :MWRead.

:MWSearch [query]

Searches for pages matching [query] and displays a title list that you can gf, C-w f, or hit Enter on.

:MWSubpages [article-name]

Displays a list of subpages of the given article (or the article you are on) which you can gf on to navigate to.

:MWBrowse [article-name]

Views the article specified in your configured browser. If you don't specify an article name, it defaults to the article you currently have open with :MWRead.

Configuration

If you don't specify these settings, vim-mediawiki-editor will prompt you when you first run a vim-mediawiki-editor command.

g:mediawiki_editor_url

The URL of the site you're editing. For the English wikipedia, that'd be en.wikipedia.org.

g:mediawiki_editor_path

The MediaWiki script path. For the wikipedias and other WMF wikis, this is /w/, but for other wikis it can be /, /wiki/, or some other value.

g:mediawiki_editor_domain

The domain name for authentication. Used by some auth extensions. This is optional, so it won't be prompted for by Vim. You need to put it in your .vimrc if you want to use it.

g:mediawiki_editor_username

Your account username.

g:mediawiki_editor_password

Your account password. I recommend putting the URL and username in your .vimrc and letting Vim ask for your password.

g:mediawiki_basicauth_enabled

Set this to on to enable HTTP Basic Authentication.

g:mediawiki_basicauth_username

The HTTP Basic Auth Username. Will be prompted if not provided and basic g:mediawiki_basicauth_enabled is on.

g:mediawiki_basicauth_password

The HTTP Basic Auth Password. Will be prompted if not provided and basic g:mediawiki_basicauth_enabled is on.

g:mediawiki_search_scope

Search scope: ‘text’ for fulltext, or ‘title’ for titles only. Depending on the search backend, both options may not be available. For instance CirrusSearch doesn’t support ‘title’, but instead provides an “intitle:” query string filter.

Default : title

Testing

See the current integration test for mwclient in the tests directory. It tests for Python 2 and 3 compatibility as well as across versions of mwclient.

Contributing

This plugin is currently quite simple. Contributions, suggestions, and feedback are all welcomed!

About

Edit MediaWiki pages from Vim!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.2%
  • Vim Script 21.5%
  • Dockerfile 2.7%
  • Shell 2.6%