I have a file read.html
, every time I paste something(e.g. from a webpage) into the file, I hope the original html format is also pasted along with the plain text. Here is a vim command that can achieve the goal,
set cb^=html
But when I paste something into other files, I don't want the html format attached, so every time I just want plain text, I have to execute this command,
set cb-=html
This could be very inconvenient, because I have to execute the two commands every now and then. So is there a method that could paste html format along with plain text when the current file is read.html
, and only paste plain text when the current file is not read.html
?
You might be able to use the BufEnter
autocommand.
autocmd BufEnter * if (&ft ==# 'html') | set cb^=html | else | set cb-=html | endif
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments