Skip to main content

Add your description here

Project description

Advanced URI Handling for the Modern Vim User

Downloads PyPI Version Build Status

Background: Rewriting a Vim Plugin in Rust

This Rust re-implementation of VIM plugin vimania-uri with 10x faster VIM startup time and bkmr integration.

Key Features

  1. Open URIs and Various File Types: Seamlessly open URIs, HTML files, DOCX, PPTX, JPG, PNG, MP3, and more.
  2. Handle Almost Any URI: Manage a wide range of URI formats, ensuring maximum compatibility and flexibility.
  3. Paste URLs as Markdown Links: Automatically fetch the title and create reference-style Markdown links for easy documentation.
  4. Jump to Headings or Line Numbers: Navigate directly to specific headings or line numbers within files for quick access.
  5. Bookmark Manager Integration: Load your URIs into Rust based CLI Bookmark Manager bkmr.

Why?

Vim's native gx is effective but limited. Same is true for other plugins I am aware of. I wanted more powerful URI handling.

demo

vimania-uri-rs demo - YouTube

Works best in combination with vim-markdown, but is not limited to markdown files.

User Interface

Position cursor on URI and type go.

go

Handled Link Types

  • local text links: [foo](second.md) will be opened inside vim. If the target contains line number as in [foo](second.md:30), the line will be jumped to. Also anchors are supported, for example [foo](second.md#custom-id).
  • URL links: [google](https://google.com) will be opened with the OS browser.
  • non text files: if the option g:vimania-uri#Extensions is set, non text files will be opened via the operating system. This behavior is handy when linking to binary documents, for example PDFs.
  • internal links: [Link Text](#Target), will link to the heading # Target. Following the link will jump to the heading inside vim. Currently both github style anchors, all words lowercased and hyphenated, and jupyter style anchros, all words hyphenated, are supported.
  • reference style links: for links of the form [foo][label], vimania-uri will lookup the corresponding label and open the target referenced there.
  • implicit name links: for links of the form [foo][] will use foo as the label and then follow the logic of reference style links.
  • custom ids via attribute lists: the id a link target can be defined via [attribute lists][attr-lists] of the form {: #someid ...}. This way fixed name references can be defined to prevent links from going stale after headings have been changed.
  • local link format of pelican: vimania-uri handles |filename| ... and {filename} ... links as expected, for example [link](|filename|./second.md) and [link]({filename}../posts/second.md).

Usage

In VIM normal mode in a Markdown document, type go while curser is on markdown-link. If the link is a local file it will be opened in vim (C-o will get you back). Otherwise, it will be opened via OS open command (.e.g Web-Broser, Microsoft Office, ...).

The following links will be handled (the possible cursor positions are indicated by ^):

Local text links: [link](foo.md) will be opened inside vim. 
                  ^^^^^^^^^^^^^^
If target contains line number as in [link](foo.md:30), the line will be jumped to. 
Also anchors are supported, for example [link](foo.md#anchor)

This [link](https://example.com) will be opened inside the browser.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

This $HOME/dir will be opened inside OS file browser
     ^^^^^^^^^

This $HOME/dir/present.pptx will open in Powerpoint
     ^^^^^^^^^^^^^^^^^^^^^^

[link](example.pdf) will be opened in pdf reader
^^^^^^^^^^^^^^^^^^^

Document internal linking works, too: to link to the heading Usage, use
this [link](#usage).
     ^^^^^^^^^^^^^^

Reference style [links][ref-style-link] will open http://example.com in browser
                ^^^^^^^^^^^^^^^^^^^^^^^
[ref-style-link]: http://example.com

The behavior can be configured via the following options:

  • g:vimania_uri_extensions: a comma separated list of file extensions. Only files with the given extensions will be opened in vim, all other files will be opened via OS default (open on OSX and xdg-open on linux).

    Default: ['.md','.txt','.rst','.py','.conf','.sh','.json','.yaml','.yml'].

  • g:vimania_uri_twbm_integration: Boolean flag to configure bkmr integration (see below)

    Default: 0.


Installation

1. vim-plug:

Plug 'https://github.com/sysid/vimania-uri-rs.git', {'do': 'pip install vimania-uri-rs --upgrade --target ~/.vim/plugged/vimania-uri-rs/pythonx', 'branch': 'main'}
  let g:vimania_uri_extensions=['.md','.txt','.rst','.py']
  let g:vimania_uri_twbm_integration=1  "if bkmr is installed else 0
  • vim must be compiled with +python3 support.
  • pip must be in PATH for installation of dependencies in vimania/pythonx.
  • tested on Linux/MacOS
  • sometimes you need to refresh vim help: :helptags ALL

2. If you want to compile it yourself:

  • rust, maturin must be installed (on PATH) to build the plugin
Plug 'https://github.com/sysid/vimania-uri-rs.git', {'do': 'python3 build.py', 'branch': 'main'}

3. Manual installation:

cd ~/.vim/plugged
git clone https://github.com/sysid/vimania-uri-rs.git
python3 build.py

Credits

  • inspired by UltiSnips.
  • URI handling is based on work of Christopher Prohm: mdnav

Similar work

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vimania_uri_rs-1.1.2-cp313-cp313-manylinux_2_34_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

vimania_uri_rs-1.1.2-cp313-cp313-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

vimania_uri_rs-1.1.2-cp313-cp313-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

vimania_uri_rs-1.1.2-cp312-cp312-manylinux_2_34_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

vimania_uri_rs-1.1.2-cp312-cp312-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

vimania_uri_rs-1.1.2-cp312-cp312-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

vimania_uri_rs-1.1.2-cp311-cp311-manylinux_2_34_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

vimania_uri_rs-1.1.2-cp311-cp311-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

vimania_uri_rs-1.1.2-cp311-cp311-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

vimania_uri_rs-1.1.2-cp310-cp310-manylinux_2_34_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

vimania_uri_rs-1.1.2-cp310-cp310-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

vimania_uri_rs-1.1.2-cp310-cp310-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file vimania_uri_rs-1.1.2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d804786a888259539f416e7f2541e4f6815c4ec4567becd9fe71abbb06783c25
MD5 31f4c9adb5e221890d5e35dfd5246c6e
BLAKE2b-256 7867933e0ec455eb3383516a11ec5dfb409a75d718e1e85f8f96bc55e30e2d2c

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edba608e5882919cc10ca5ccac0bf95fa78e627104c796d9a5fc087beb1d98ad
MD5 eb47adf08ee7d91903b69b06d5f2ded5
BLAKE2b-256 ae0cbc9e159ecc77b3cdc24d81c5f83a886e4d52e69f996ecc7b5c203285f43d

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd07e0b0cf1ffcc43bccffa5bb11e5e890130c4d4086eab38aa6d86635bfcc72
MD5 f6bd1790142e6f09c002496c611a1dc1
BLAKE2b-256 b9bba948acd8a0d6b1170549cd06901b4e4abd5ae111fd5ab51c8fc30092fedd

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6a305b2345ad3eee6b4af0fa36793e6b774c1fd815e7a017026c9c52f802a233
MD5 72eca3ce022115583fe0f17eb7b80e60
BLAKE2b-256 7221aa15090f5cea6413143c5f23cc3f6bc09031093d70280b7a513931f0e05c

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88e7a5dc0709d0cb183057faf669188fd8a7e4d3161b3ec82b0fbde6c6c0d4fa
MD5 8e3b532add71bf54283f438580974d78
BLAKE2b-256 9d53d6513c00c5e70a32334dc41eff7a66ab70d8ba2ec4c5ab8ed2fdd628a53a

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c0487db2448074a63e05e069e196d750fb691e74681ceab48e1b16147cd9930a
MD5 c874f504bd65bdd59069012d52331326
BLAKE2b-256 ec6a8f6125be48534329e28c76c71cbd979de1887715e04ad66e36714c31db08

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d421330aeb3774e45eafd127a02a2919a2f0d78f11ad39ac5eab285be17bcab7
MD5 97c3b64267eecaa48fc405c41a4c4dff
BLAKE2b-256 887b68c360c864732002cd23879c42fe9874ecb7a0931b028b7e929ca6dd44e1

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cae64c614f94bea4fbfeb720a435bc7b3a33c63fa0cff61ca2b0b07ee5f70eb9
MD5 fef1af1fac8d97dc1e93363a5c296a4a
BLAKE2b-256 156df560eeaa60548b6c9a65d60b6db541e934e91b794e35b43f6f8b7c2a694d

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fdc27b39983cf8f13de2813ebc365addddb1519c8e7ab73552c5d2f6406794f8
MD5 cd91cf4a6af9239d0ba8b1f6628ee162
BLAKE2b-256 d1ec1c02ea9d47ea01905a251f914e5198dedf503bdf90fc42cfd8a7fa13ed55

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 82ceb52514a2a01d3d97d91554594994916f189ab30f2c9c369640412e6f572c
MD5 908560c254eedf1876c5a23a65664fe8
BLAKE2b-256 f18a0edcd35650f19680742de8cfa2e0bf8370d5aa7a67fe9ff0a8060b364640

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 add93504ce8dda6cf744f4233dca72254f25e3055bb1538adef068abaa48189d
MD5 34a7c8ec01f69777a3a229f303eea54b
BLAKE2b-256 d2dacd09791585e9037fa94e33c02dd8f5e69f0ec790a6592346bc093754bc18

See more details on using hashes here.

File details

Details for the file vimania_uri_rs-1.1.2-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.2-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e8c94527d28688bc01293a73ce2442a613ae575f1ebfe9fe5183c675297ebb38
MD5 34dd5d1a3edf751ba4dafb6e72ad24d9
BLAKE2b-256 1d4ce809f228bf07e9e69febde009fc312efb3c7fdabde4cf9b003c84b39cee7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page