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.4-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.4-cp313-cp313-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

vimania_uri_rs-1.1.4-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.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

vimania_uri_rs-1.1.4-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.4-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.4-cp311-cp311-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

vimania_uri_rs-1.1.4-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.4-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.4-cp310-cp310-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

vimania_uri_rs-1.1.4-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.4-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7e7b1928e7d8a8c89ef7c589ddbe6ca6b863ee3dee66f30ca70325a497a0c987
MD5 38cf375dc806049f18f5253c2d38b52c
BLAKE2b-256 87d0ad4097854c5fce3cffa644b6b65d8a502409c6af60d997273dfd50421309

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62c3fc9f2d35e65f08c929f8aa6465a9d7bcaef46344c922faf57bded2ceec61
MD5 ec4eb2869a14405870ec418d16086103
BLAKE2b-256 27987ddc5cce8dd1c4bf7a37f2cbfe998e8651ce27580150148459140e3a5bca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 66c6019630b5be7872394cc56ea9f01e51489157ca2078900f57613198433922
MD5 648238b61bc268546b4e59ab4013cc15
BLAKE2b-256 eb47ceb14bb94ebe2a1d23878ad9025ee5066cb2c00df1bd5db514ea7a9ed138

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 018154fb0392fe5b387d1420c74562923fb740a5948b70db369700001df63be8
MD5 2e4dce8e4eae26c379013f385a1de3ee
BLAKE2b-256 3bd4b9050f207b6a0f8197388df72925417b4d3dfdd3a926f91cca57c32506e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd40169677072ee11d7554bd02fdaf8b5dd0206c9156b20bb49d4289e4498e4c
MD5 db410f13db4e10a1180a99ec00d30d5c
BLAKE2b-256 93d7041d9c81070a014f422976bc30e5d40d37befec10d513482a0a732723942

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6a65ec046ffbb1430147197166f9928d19be2f8b9ad9cdc8380b3029c5242f89
MD5 33afa665bf953ae86fe1ac867fb78abc
BLAKE2b-256 b24893d52c43c5d485eea268c140b60e4e2bcba3965437aab0031b662e76312f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 172533a80a7cba709ba862cbd36fd9416f87b5bb91403dcf0ff1ce28b16af5be
MD5 a0643da010aba9e9aaa2b60c3857c182
BLAKE2b-256 1ce23b563ce3c463a0929b840f54b240b43d07b571dc58a86786aaac9cd9f5fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 321d7ff2c0e57a2b393012254f977579fe61e0f672e5417e0f9dc5d9b3f2991f
MD5 bfc0d96365ac106e633f8686b8390777
BLAKE2b-256 b1e2f56cc366e00f7e8c4519b46a5ed17f1faf408f8d82f5e98dfce26edfc0cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 917c0eb0e197e2282312221aef6e2a63f1a0f926974f06e2bb286d8ca9ef61ad
MD5 7288b5d049f17bf4ff0adb949176d2a9
BLAKE2b-256 647c9ef996365d9dbb3d82e802380fb91caabc6181271e1f9ada86003fab17f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 66d8403bd6534ff5e21c188c04554185f23e808d2243c03b4ea6c4b14194c254
MD5 77732b50f2cdddd14e10abc3f81600ed
BLAKE2b-256 bbb9a184009f78cfb9ee818282e4ac16930da19d2cbc7bc3804729a1b094d11f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edbe8c42563cfa4f4dce0012ee27376a4ad0afca46929bf6f8edd1bc2d7b39ed
MD5 e56c789beb3e11c008ed373ead84bcf1
BLAKE2b-256 f1d6ccc79e3d1800ade49164acb8fc94ba682bcdf179b8b3d02902b6605fef89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.4-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5eec4fe075b75d79f96241aa6f3092db876c32d4bce554d7c02e290b9eaf9611
MD5 af1a51b9f27924a7ccbcc54bf37a361c
BLAKE2b-256 39f686f57f1011a34717baf58ab5370c11782e93a57283730493e614c3bd3b48

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