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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

vimania_uri_rs-1.1.5-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.5-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 696c4cf0a1aa83e863958318ac2991dab0e6a1fd22822e61125ed952770f87f7
MD5 9d590f62bf9a5fdc38a9d6988979ec30
BLAKE2b-256 5e8c40ad001d79ebae690e429fa3db9bc156157096422f515913b2ec43bed90f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0628164e5223da21501073660e45895b3f07151bf22abf174798ceddd272161d
MD5 9d121f41308eee41732bad22a1f6f1b4
BLAKE2b-256 8e87494b30c7d533ef648d40911d9e385774c4957ec51ebc5e6f0aaf45440764

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 47e16e0178403fbc0cebc14fce79b8df02f6f25c81913df8fb806a7885a336b7
MD5 30eec884540ad16c92ab0085346d0bd8
BLAKE2b-256 084c21ef983b5b47cb2c6957735a5296a96d37246fef9e81c8d862819b478c2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7f5aedba0e24829c7e69bb439a889417840b069f72de2220c9587f988d2b02b6
MD5 0b97d4f79e332959647e9119beb9e56c
BLAKE2b-256 63234322a0e206bfb14a38c0314337d88d2537ad951321b159cf3aa0569e94e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65415cd126dff2eb41098d23abffe0543cb0dd9389e473c5bc23594c3eaa8195
MD5 ec6fc92da56f53fbe808bac8e55c3f64
BLAKE2b-256 0ce571207e6d1b665f2676cd922f05fd084a6a62766d02fe296e74c2dd65c81f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fcf98423a22f254b5d113e3a9022043cf7f175144055f9dfb7de30cf8f3768ba
MD5 834a306bf4ff8157f707fe9a580a2a9b
BLAKE2b-256 8e0ae3054a9b522c6fb4775e25fdcfa91b2a27a0c13f9ae53acd39a0f4de6189

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 886d55e152526b666791187733348d7406ac592df995ad4e3e4fb5949395498a
MD5 bdf9946a1586b21d724f6f0a3b672eb2
BLAKE2b-256 0d61eaba2d8e9255d1752ac7db212f4aa3d0e6f6a8d33371b6132dec4de235bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89b33e9bf68d02ea0c539fe1eaeccde5fddc98979725bc41760e87e2d7347edf
MD5 43d6fe12d8c889429bd45141eb02a1c3
BLAKE2b-256 73f798c0f556987f207ae6da18b08b1fdb2e5f3ea8b5e1505d5cb0364e6be994

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e1e209d20f2961dffa4e804968fefc43fc50bd88ee6dce272af8abd4a67f93ec
MD5 f663dba913976c9bfa808b9b90a58d82
BLAKE2b-256 d3d41dd496f8358721b653a6b5adad95b69c16adb928c7fa069e96d5d30d440b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4cfb4efc4f35162f53eb28b0075e3870cd40587f4141618b5a265508ca7357d9
MD5 24b3d039edc437f5db64d22ddeef929a
BLAKE2b-256 b59fdca6cea4e95880f093ac0d88c80bc885e16d9fa0fab7b8231846c8a0de59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82bd209f6a01897b941ea60c4d093839b88ae7bb1b6e9df7ba54b6a0585dd8c4
MD5 913e1e85be58fec3a50b05152b8d0ddb
BLAKE2b-256 537d614277ac151531338e969741ed0e5f5233a3108b8dd73ebcc77b30dcdac5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.5-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 42af0be3fcea74b9ad90388ae4d54b8d2cef87b7ffa814eab6cc6c8d6cec944b
MD5 b41440dae30b094ebb0b98d4bb2b3bff
BLAKE2b-256 bd79c19b3cdc4590fc3144e6bc7250c9c90b9f3753ba5f7c626a0ad5378a0563

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