Skip to main content

Add your description here

Project description

Advanced URI Handling for the Modern Vim User

Intuitive, Fast, and Powerful

Background: https://sysid.github.io/vimania-uri/

This Rust re-implementation of vimania-uri shows 10x faster VIM startup time.

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 in my markdown files.

demo

User Interface

Position cursor on URI and type go.

go

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 normal model within a Markdown document, press go on a markdown-link to open it. 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 (.e.g Web-Broser, Microsoft Office, ...)

The following links can be used (the possible cursor positions are indicated by ^):

This [link](https://example.com) will be opened inside the browser.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

This [link](./foo.md) will open `./foo.md` inside vim.
     ^^^^^^^^^^^^^^^^

This [link](|filename|./foo.md) will open `./foo.md` inside vim.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^

This $HOME/dir will be opened inside file browser
     ^^^^^^^^^

This $HOME/dir/present.pptx will open in Powerpoint
     ^^^^^^^^^^^^^^^^^^^^^^


If `g:vimania-uri_Extensions` is set to `.md, .MD`

[link](|filename|./example.pdf) will be opened in pdf reader
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 the configured application (using open on OSX and xdg-open on linux).

  • g:vimania_uri_twbm_integration: Boolean flag to configure twbm integration (see below)


Installation

Using vim-plug:

"Plug 'https://github.com/sysid/vimania-uri-rs.git', {'do': 'python3 build.py', 'branch': 'main'}
  let g:vimania_uri_extensions=['.md','.txt','.rst','.py']
  let g:vimania_uri_twbm_integration=1  # if twbm is installed
  • rust, maturin must be installed (on PATH) to build the plugin
  • 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

Shortcut to create URI

snippet uri "link/uri for markdown and vimania-uri"
[${1:link}]($1)
endsnippet

Credits

Changelog

CHANGELOG

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 77c0bc91290ed818111c4237e40b22c09bd56b1f552ddba1f2f684a7efa8f1dc
MD5 4036f226f9c25f90b6f9829fbc1302fd
BLAKE2b-256 f81011983f0f9dff09a81221c4a54e77cb53dab2a21a4e7109027a48b85f51a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vimania_uri_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15c6d3d83215a1196ff640b7a820fc10f494146a7861237478b980df0a722933
MD5 eb0b5f12b15b598d099afbaeac158758
BLAKE2b-256 552224664f18e5ef25d2e2bc3d14bf6949ac365a3aa9ad6efffee8d5289c4d8f

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