/vviki

AsciiDoc-flavored wiki plugin for Vim

Primary LanguageVim ScriptMIT LicenseMIT

VViki

MOVED! Hello, I am moving my repos to http://ratfactor.com/repos/ and setting them to read-only ("archived") on GitHub. Thank you, -Dave

VViki Logo

Overview

VViki is a tiny AsciiDoc-flavored wiki plugin for Vim. It was inspired by VimWiki, uses Vim’s existing AsciiDoc syntax highlighting, and aims to be extremely lightweight.

Features / Usage

  • Hit Enter on a word to create a link

  • Hit Enter on a link to edit that page (or open URL in a browser)

  • Backspace opens previous page

  • Tab jumps the cursor to the next link on the page

Install

VViki is in the standard Vim plugin structure. Any plugin installation method (incuding popular plugin managers) should work. If you have additional installation instructions to add here, I’ll gladly add them:

Vundle

Add this to your plugin list (in your .vimrc file):

Plugin 'ratfactor/vviki'

Then run :source % and :BundleInstall.

Setup

Add something like this to your ~/.vimrc file (or equivalent):

" VViki setup - relies on the default wiki root dir (~/wiki)
nnoremap <leader>ww :e ~/wiki/index.adoc<cr>

The above mapping will open a page called index when you type '<leader>ww'. (Vim’s default leader key is '\'. If you’ve not changed it, you’d type type '\ww'.) Users coming from VimWiki will be familiar with this mapping.

Note: VViki does not currently create directories, so you’ll need to create ~/wiki if it does not already exist.

Advanced Setup

By default, VViki uses ~/wiki as the wiki "root" directory and looks for pages having an .adoc extension. Any file under this directory (or subdirectory) ending in .adoc will be detected as a wiki page.

Here’s a setup example which changes the root directory and extension:

" VViki setup
let g:vviki_root = "~/secret_diary"
let g:vviki_ext  = ".txt"
nnoremap <leader>ww :e ~/secret_diary/index.txt<cr>

See :help vviki for complete documentation and specifically :help vviki-configuration for all settings.

Why?

I love VimWiki. I also love AsciiDoc, but VimWiki doesn’t support AsciiDoc syntax. I put a day or two into adding full AsciiDoc support to VimWiki, but eventually concluded, "it would be faster just to create my own plugin." And it was!

VViki aims to "do one thing and do it well". This table explains the difference:

Feature VimWiki VViki

Wiki functionality

X

X

Syntax highlighting

X

Tooling (search, HTML export, etc.)

X

Testing

Running the interactive test script is an easy way to try out VViki’s basic functionality without setting up or installing anything. VViki does not even need to be installed as a plugin!

To go from nothing to trying out and testing a wiki, try this:

git clone https://github.com/ratfactor/vviki
cd vviki
vim -S test/test.vim

The first test document should open immediately. It contains instructions for using the tests (shortcut keys are mapped for fast/easy usage). All tests are self-documented.

TODO

  • ✓ Absolute vs relative internal links

  • ✓ Make VViki a "real" plugin

  • ✓ Fix bug with description in link macros - need proper line parsing

  • ✓ Try using 'conceal' for syntax to display pretty links

  • ✓ Configurable wiki path

  • ✓ Configurable wiki file extension

  • ✓ Add default "index" files for "directory/" wiki paths

  • ✓ Start help doc

  • ✓ Finish help doc

  • ✓ Global setting to turn off link syntax conceal

  • ✓ Add <tab> key link navigation (jump to next link)

  • ✓ Release 1.0

  • ❏ Wishlist: Consider creating directories as needed (limit to wiki root)

  • ❏ Wishlist: some sort of shortcut (with pattern matching) to add links to existing wiki pages

  • ❏ Wishlist: checklist shortcuts (check/uncheck [ ] boxes)

License

MIT License

Copyright (c) 2020 Dave Gauer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.