Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pasting styled text from system clipboard

Tags:

vim

copy-paste

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

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

like image 612
Alkini Avatar asked Mar 19 '12 21:03

Alkini


People also ask

How do I copy and paste without messing up formatting?

To paste without formatting, press Ctrl+Shift+V instead of Ctrl+V. This works in a wide variety of applications, including web browsers like Google Chrome.

How do I copy and paste text with formatting?

Keyboard shortcuts To apply the formatting you copied to a different text selection: Press Ctrl + Alt + v (Windows or Chrome OS) or ⌘ + Option + v (Mac).

How do you paste unformatted text in Word?

Use Ctrl + Alt + V (or Cmd + Alt + V on a Mac) to open the Paste Special window. Here, select Unformatted Text to paste in plain text. Finally, if you'd like, you can set the default paste option in Word to always paste in plain text.


1 Answers

Temporary adding html to clipboard option 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.
like image 168
ZyX Avatar answered Sep 28 '22 10:09

ZyX