Copy the (visual selected) color rendered text from a VIM buffer to the system clipboard.
This plugin uses the default installed script 'syntax/2html.vim' (see :help :TOhtml
) to convert the content to HTML.
For Windows systems you additionally need a python installation accessible from VIM (see :help python
).
For Un*x like systems the application xclip
will be used by default to copy the content to the system clipboard.
MacOS X already comes with the needed tools (textutil
and pbcopy
).
Install using your favorite (or the build-in) plugin manager, e.g.
Add the following configuration to your .vimrc
Plug 'grueslayer/vim-cliphtml'
and install with :PlugInstall.
This command will be used to write the content of the converted HTML buffer to the system clipboard.
The following defaults are used:
- Win32: (Python is used)
- MacOS:
write !textutil -stdin -stdout -format html -convert rtf | pbcopy
- Un*x:
write !xclip -t text/html -selection clipboard
Contains a hash array of global variables to change the bahaviour of :TOhtml (see :help :TOhtml
) explicit for this function.
The previous values will be restored after creating the content.
Example:
let g:cliphtml_tohtml_options = {
\ 'g:html_ignore_folding' : 1,
\ 'g:html_number_lines' : 1,
\ 'g:html_font' : ['consolas','verdana']
\ }
- HtmlClipboard.py - Python code to access Win32 clipboard. Revised version of Phillip Piper's original post.
- Scott Graham - Initial work - ClipHtml
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details