Giter Club home page Giter Club logo

vimwiki-nirvana's Introduction

vimwiki-nirvana

Background information: https://sysid.github.io/vimwiki/

Vimwiki-nirvana extends Vimwiki functionality by providing a custom handler for links. This handler implements:

  1. Windows Subsystem for Linux (WSL) support for vimwiki.
  2. Link translation capabilities
  3. Custom application configuration

This plugin requires https://github.com/xolox/vim-misc in order to establish OS detection. It is tested on Linux, Mac and WSL.

Installation

Install it with your favorite plugin manager, e.g. Pathogen.

General idea:

Vimwiki handles OS native paths very well. However the default behaviour fails on Windows Subsystem for Linux.

This plugin extends Vimwiki so that WSL works.

Additionally it allows to translate paths and to specifiy custom applications in case the default behaviour is not what you need.

Instead of using the default file:/path schema custom schemes are supported: custom_schema::/path

Custom schemes call the vimwiki-nirvana handler which translates the path and calls the specified application. If no application is specified, the default launchers (open, xdg-open, start) are used.

Features

WSL support:

No configuration required for HTTP links.

When vimwiki-nirvana detects WLS, it automatically sets explorer.exe as your default program launcher for schema http, https and file:/mnt/c. To this end vimwiki-nirvana changes the path file:/mnt/<drive_letter>/a/b/ to <DRIVE_LETTER>:\a\b. This allows explorer.exe to open the path with the registered Windows application. For convenience Windows links like C:\path are allowed, e.g. file:C:\tmp.

Link Translation

A path 'prefix' will be replaced by a 'replacement'. The resulting path will be fed to the specified executable to open the file. If no executable is given, the defaults are used (open, xdg-open, start).

Configuration in .vimrc:

let g:twvim_handlers = {
      \ 'custom_schema': {'prefix': 'smb://a', 'replacement': '/Volume', 'executable': 'program for opening the file'},
\ }

Resulting Translation: custom_schema::smb://a/b/file.txt -> /Volume/b/file.txt

Example:

let g:twvim_handlers = {
      \ 'home': {'prefix': 'smb://uh01500696.bmwgroup.net/home\$', 'replacement': '/Volumes/xxx'},
      \ 'win_d': {'prefix': '/mnt/d', 'replacement': 'D:', 'executable': 'explorer.exe'},
\ }

Caution:

  • Special characters in your path prefix (e.g. $) have to be escaped.
  • the executable has to be in your search PATH or you need to specify the full path

Vim Integration

Vimwiki opens its text files by just clicking the link. It would be nice, if this feature also applies to arbitrary text files so that they are being opened in a new tab.

A dedicated schema makes this possible: vim::~/development/xxx.py.

Use the following config in .vimrc:

let g:twvim_handlers = {
      \ 'vim': {'prefix': '', 'replacement': '', 'executable': 'vim'},
\ }

You can use path translation, i.e. specify prefix, replacement if needed.

vimwiki-nirvana's People

Contributors

sysid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vimwiki-nirvana's Issues

TwHandler: Must activate action.

It seems like the only allowed executable besides the default is vim (and nvim). Any other application on I tried receives the same error:

W- TwHandler: Must activate action.

I tried with julia and zathura and I had the same error. I believe this is because in if block starting in line 42 of handler.vim, it only tests whether "executable" is "vim" otherwise it throws the error. I don't have much experience in vimscript or any other kind of programming, to be honest. I mostly use vim to write notes in vimiwiki and latex and some small simulations as a mathematician. So, I might be completely wrong

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.