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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

vimania_uri_rs-1.1.3-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.3-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f0829b61062b78927de003309bb330341d99c8f72218407b8c4300327eff53c0
MD5 4f5d6d6f012f4c8ab3159f2c5002566e
BLAKE2b-256 6db82d6daa3bfc7c4f6b1bc138cc9b7b89aec74f576e00ba18f09822e4e860ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 166e0681aa528864011c3d26270e8acbeb8982924ec2dadd2f796ea73eaf8e2e
MD5 12383eb14fde831c7a68a7a07e41134f
BLAKE2b-256 025c3c10bcf72d37fa159a0974fd9819a251b1238a445962c3e83438bcf49aa4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4ad7451f48a040b0b34926e618c50e047f5f3dbe5d09798e62e2c7757bef210d
MD5 ef21342bd2f35063abd802657b731e88
BLAKE2b-256 80493a2e236f847081b598f549afa50b76673d1eceaef055fd650bffb44d7e7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8fd47b728421ee11175c25475e68ad1d42ae5f09ae4ab4bc7529166b9247e4c8
MD5 89a5d9960b4e60f67bf95ae948b0f293
BLAKE2b-256 53ee5f5ebed756ac1a78876669fc1477b2acc27287cbb30b5e84983f7ab7fc7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bca9d4e3198f6fd8eb200d57b5238649da72a91fb55ed8bd2961e262312975df
MD5 eb7d50ac58f5844b54f594b88c9068ef
BLAKE2b-256 1f27dc720edc8dac56d942db149b9e96ba5b769e09216d294f5af5c1a47acdb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d445e167b7189085479f126360f25aba2109f4b785afc6ce3be491ee8d3f515c
MD5 b1a8e0e215cc1bca34b2e58b576f0d19
BLAKE2b-256 84d097786a861e4a8c81a4d2757be278ee5f32931a506dadd072c239d0068088

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e45e7a1b335c2cb6edfa6bc15ce54fd60e10437e7dee1f463c42a8ab92b01b8d
MD5 350746a175f454446d76bd510469ca08
BLAKE2b-256 9fc868beb979f339f74d1e815a45f0e67cdc2959ad3decbb86629dc9367bfe4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 903a6cda0e796b81ac6a2ba08426bb0161cda30dd762faae1011e4364d7deab9
MD5 38820998e1d31b310b1a71312fae509a
BLAKE2b-256 2d678968fdfe7a39621cc2440941fd870573d4c115f0ca17f7017be007cdfcd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 55aee6153adea1401c59ee69e0ef272a87aeb65b9040d8f8c117df3a299165c7
MD5 1074c5a680b2701965e9061a0dd6e53d
BLAKE2b-256 b26802b37489fbc5cd6a183eeaec56e6c9c9579e751b339e5836c3dfa107b59d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8cd679ad754ee8fd610fb8d0fe759e84a381eb0385d562a629885bb103a0cd14
MD5 0363d0f0f54f1b5be1436656e6666d93
BLAKE2b-256 d4627e9c66f14bb0042aec57e754414091bb7053f32b7e8dead163f2136494ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 791e5edcc954a4432abf118a42863d5ef8771ad935d847f56fd19d47b66797ed
MD5 d69112bfa87e631ccb6de391c3c41408
BLAKE2b-256 c7c524c08e60b99abd35ea61c3a291e1d78ed23e37f22c233e2e42d19aabcca8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-1.1.3-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6d09998fc6cd61873a0dfbf11cbbad6ca7ec5f02bba8de3c5a8f4c92059cb5bc
MD5 5dff3e2511264b5636f6e8e43a3e0d49
BLAKE2b-256 ea5afb7405e6385d46eb3615dbcb4d91e947ed98d63421185e4d499cd3e35348

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