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

Using 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 needs to be configured with python support
  • pip must be in path to install required dependencies into vimania/pythonx (no pollution of system python).
  • tested on Linux/MacOS
  • sometimes you need to refresh vim help: :helptags ALL

Alternatively 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'}

Fully 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

vimania_uri_rs-1.1.1-cp312-cp312-manylinux_2_34_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.12+ x86-64

vimania_uri_rs-1.1.1-cp311-cp311-manylinux_2_34_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.12+ x86-64

vimania_uri_rs-1.1.1-cp310-cp310-manylinux_2_34_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d7ea3dcacb5fee3c492e16a54e9437d885f37a2dfc5b32ed76a3ed3352d71178
MD5 fdb833bd0c6ecaf4d70407ff48ef136e
BLAKE2b-256 a67b8e509f0b0545e7679174977312148b0b64614661fd228f898ff37b772794

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 437fa9406f6501ae34689d8609700071a256716dcd0af3c15c75d73feb97c2d5
MD5 1664f89a1df6e959a3924a47328f5fc6
BLAKE2b-256 6aeb5e08602efe6f8fd26f0209a3e0a2d244e438d16351acd62e67009e837b68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e8dc37f32d44a1eba14cf1e69ea0f6670a5fddded86ed6d3963f694cf5f98335
MD5 4ca68306a82d6d72ac33471a8f5ada7e
BLAKE2b-256 7c29fb4aea806e4cff5909aacd24dfe461db452f1f35ceea8303d8417980506a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 843a64264283c46a4cfe6ac8a1495eff3748ecb26efbda74a29c2249a3f01b3e
MD5 b8f40193e1de6af668f9a316b6a73069
BLAKE2b-256 9877b6f627d8e191adf1d56801df7d422d29be8c7cc825587565fdc11d2fcdea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efa5b7d0954b7956f3595e165187cf550f403702e571c56bf6ce8a2097439518
MD5 15b7bd6bf42512a50af81213b2e6760c
BLAKE2b-256 b8d241f3f0eef4875af4e139c4615ad9ca3f7a9ddb064c074b14e9ee647f5d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fc110c30c3198d2480008cd596f98d72d1559a45ba1c15b44803b7b3bb985634
MD5 d357bc292bd455c566234e59660e982c
BLAKE2b-256 5faf6b659e395ad70b2cccb14883121b5e2b4b58ed1cfbfbdc56b6cb8ee5b76c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2cd523dcf00092d039236ef6e21d4bdb7535cd0fc2e413ed4cf74d7063d56c05
MD5 d2c2b149f73670827b2a192fb4a66ded
BLAKE2b-256 f3c3924695fd68c484ddb71111f5e959ddf5b63c97b7b62099723c9127be8266

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b08519933514209b64de38173857a97d2a6a8133db134dc867a579d0f0b3127b
MD5 24257ead30203247c3307632a38bd39b
BLAKE2b-256 e5caf8a45d7b3591f5d6290748af2b5e236fd297d1f21fb814c199cf41b68abc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 11539b6ba15eb289b48fe9f5ab8e1206f7229602b42c2dae2b77f2985135eecb
MD5 d071355cc8cf86e99fa2e75577cd3b8e
BLAKE2b-256 803fcd1bd87533efab195deb19146243603400e8d6d647c1bfb030ce75475c89

See more details on using hashes here.

Supported by

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