Pasting styled text from the system clipboard

In vim, how can a person paste styled text from the system clipboard rather than plain text?

For example, copying from a web browser and pasting into a word processor typically results in styled text, including basic formatting (bold) and links being pasted. How can a person copy from the browser in the same way, but paste the original HTML representation of the text into vim?

+3


source to share


3 answers


Temporarily adding the parameter html

to clipboard

should help:

set clipboard^=html
put +
set clipboard-=html

      



  html            When the clipboard contains HTML, use this when
                  pasting.  When putting text on the clipboard, mark it
                  as HTML.  This works to copy rendered HTML from
                  Firefox, paste it as raw HTML in Vim, select the HTML
                  in Vim and paste it in a rich edit box in Firefox.
                  You probably want to add this only temporarily,
                  possibly use BufEnter autocommands.
                  Only supported for GTK version 2 and later.
                  Only available with the |+multi_byte| feature.

      

+6


source


Vim does not support rich text: it is a text editor, not a word processor.



+1


source


Vim only edits plain text, more or less. In any case, what you ask is not possible.

If you want, you can find the source of the HTML page and paste it into Vim, but it's still plain text (depending on the definition, I still view the markup as plain text).

-1


source







All Articles