Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you hyperlink text in vim editor?

Tags:

vim

I need to set some text to be hyperlinked to a website via the vim editor. How do I accomplish that?

like image 401
ILoveCheezits Avatar asked Oct 19 '25 13:10

ILoveCheezits


1 Answers

Vim is not a word processor. Vim displays text exactly as it is on the disk. You can do some minor "formatting" of text such as folding lines, syntax highlighting, concealing a few characters, but that's it. None of this information is actually stored in the file itself, instead, it is applied from "outside the file" with Vim. This is different from .doc files, where the formatting is stored in the file.

Note that gx opens links. Perhaps this is what you want?

What you want can maybe be done with:

  • A conceal pattern combined with some custom mappings. I haven't tried doing this, but it's probably possible.

  • The only way to "link" something in Vim is to another file using tags. See :help tags-and-searches. Perhaps this feature can be abused into opening web pages, I don't suggest that you try.

In short, you're trying to use Vim for a task it wasn't really designed to do, so doing that will be hard and ugly, if possible at all.

like image 124
Martin Tournoij Avatar answered Oct 21 '25 04:10

Martin Tournoij