Ⅰ. 插件描述
Replace inline links with unique references and a link table.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/extractlinks'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/extractlinks'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/extractlinks'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ExtractLinks
Ⅳ. 文档说明
DESCRIPTION
In forums, emails, documentation, or other plain-text files, one often embeds
references directly in the text. But many URLs are quite long, and this often
breaks the formatting and natural flow of the text. It would be better to
place those below the main text, in a neat reference section. But doing that
manually is tedious and error-prone.
This plugin leverages the :SubstituteAndYankUnique command of the
ExtractMatches.vim plugin (vimscript #4795) to extract the (configurable)
URLs found in the buffer and replace them with unique inline anchors.
Additionally, an (again configurable) table of anchor and extracted URL is
placed into a register, for easy pasting. The complete link extraction and
referencing is therefore reduced to a short and painless
:ExtractMatches | $put
In addition to a general global default, the plugin ships with predefined
pattern and replacement definitions for:
SOURCE
Inspired by
http://superuser.com/questions/717946/links-to-references-in-mutt-or-vim
USAGE
:[range]ExtractLinks [x]
Extract all links in [range] / the buffer with a
(filetype-specific, by default "[N]") unique
reference, and generate a corresponding link table
that associates the references with the respective
original links (default: "[N] {link}"). This is placed
into register [x] / the default register, so it can be
:$put
into the buffer (probably at the end, as a legend).
EXAMPLE
This text references http://www.vim.org/ and http://w3.org/.
:ExtractLinks
This text references [1] and [2].
:put
[1] http://www.vim.org/
[2] http://w3.org/