Add your description here
Project description
Advanced URI Handling for the Modern Vim User
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
- Open URIs and Various File Types: Seamlessly open URIs, HTML files, DOCX, PPTX, JPG, PNG, MP3, and more.
- Handle Almost Any URI: Manage a wide range of URI formats, ensuring maximum compatibility and flexibility.
- Paste URLs as Markdown Links: Automatically fetch the title and create reference-style Markdown links for easy documentation.
- Jump to Headings or Line Numbers: Navigate directly to specific headings or line numbers within files for quick access.
- 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.
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 usefoo
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 andxdg-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 intovimania/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
Built Distributions
File details
Details for the file vimania_uri_rs-1.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60e0a02c622426f9172ff94cf055b442042dc00dc69e144f71fceca94fe837f3 |
|
MD5 | 5f56282751bc5c07d4e7b9f74d98ccb9 |
|
BLAKE2b-256 | ae0439dc299f7b7851cd7f8801e388eac8b6ec6a7047f1fef5e5cacb6cad7dcd |
File details
Details for the file vimania_uri_rs-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7f56b3278deeb2b50714fcaddf394cea38191e74a09b60e4e1ad95c0ab7bde9 |
|
MD5 | 191b86a5fecc4b084ffe55c050e7d5b1 |
|
BLAKE2b-256 | be46463a8bbd60abc3c87131f8dbf5cf80054000045e2a37a0c5e6a3b9703dce |
File details
Details for the file vimania_uri_rs-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1e4b370506ce7272c7ac5f858db8c643996a7151833ed05ffdbe65b4462c01f |
|
MD5 | ca78929d71310e4e9b9e90970d56451c |
|
BLAKE2b-256 | 433347b1b86db38728d6a082739c349b77070245436dd17e977f851fa6ea5bae |
File details
Details for the file vimania_uri_rs-1.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e33462e88ed3b60b02173070966fc5281230376cf8ccc5bd4433c8f880547335 |
|
MD5 | 31074f86b178740c0ffac8e0a829e485 |
|
BLAKE2b-256 | 7c93db4b364f4a62379b723845923a4bd1943d0c942a4684b3024ad085ddb536 |
File details
Details for the file vimania_uri_rs-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9221a90634dd4feae9f92e5645ecd55e8aea929e99965a6ce4729bda43fc506 |
|
MD5 | 5801966037691c0702593abab6974121 |
|
BLAKE2b-256 | 2d9abd6651d9b3d286b07ef29f4fa30880c3bbc8913039c7c882be757a584ad4 |
File details
Details for the file vimania_uri_rs-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e344a0b00603492e57a597b31daa124ebafc3042fa4baa4a778360a6554ccd0 |
|
MD5 | 5857de04ffa93d1da6b2fc03d271706c |
|
BLAKE2b-256 | 8e460eeaf0bb347d12ca1aa03e6efce6107c9d31c17b25f0e92642c80f44adec |
File details
Details for the file vimania_uri_rs-1.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 803b3493577759d0abc4ee5e024c348717ebcf7acf00f373ef54d127640267d5 |
|
MD5 | d9f940ed07c7255d0dc9251b6aa1eb3f |
|
BLAKE2b-256 | 6a5d5634b913dc9f98c3055cd5b919ea44da90d46178ce8dd34ab680b72044a4 |
File details
Details for the file vimania_uri_rs-1.1.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9e860057cca3a39285d610f1d64b3812460e65af2851bbd17683e27d94bd273 |
|
MD5 | eab282a1dbebeaa12f2fe2362efb6b6e |
|
BLAKE2b-256 | ce45e618f1b31652eef4bd24d06785f667e3c33da76bf06fcd26f8863eda1b83 |
File details
Details for the file vimania_uri_rs-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: vimania_uri_rs-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36f88adb56292f58a8a8a82cc81219d13dc0c54a7c09d78950b9bb0fe15d9b1d |
|
MD5 | 755f65375247e58e8bfec15ab09ce757 |
|
BLAKE2b-256 | 611c7beb2cde07cf0c0a3683811693535541d115b8c2caa0c321eed049ffbe29 |