How to execute a command specific to a file?

Searene

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?

Jason

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to direct to file folder and execute specific file using batch command

From Dev

PowerShell - How to execute BAT (batch) command on specific file? (Concatenate path and command and propagate arguments )

From Dev

How to execute a specific command on opening a terminal

From Dev

How do I execute a command on a specific screen?

From Dev

How execute specific command from shell script

From Dev

How to execute command on list of file names in a file?

From Dev

(All variants) How to execute specific command with any command entered?

From Dev

How to execute one specific command from history command?

From Dev

How to execute a command/script after a specific command was executed?

From Dev

How to DIRECTLY execute command in txt file in cmd?

From Dev

How to execute cmd command from text file?

From Dev

How to execute and save result of an OS command to a file

From Dev

How to execute a mongo command in sh file?

From Dev

How to execute a command whenever a file changes?

From Dev

How to execute source command from sh file

From Dev

Execute command for a specific output of a command

From Dev

Execute a command in a separate file

From Dev

How to convert and Execute lib_file.a Library file in Command prompt?

From Dev

How to create a file with specific command to run in linux?

From Dev

How to redirect output to a specific file into a sed command?

From Dev

Execute command on specific screen on CentOS

From Dev

How can I execute a script as root, execute some commands in it as a specific user and just one command as root

From Dev

How to execute a java class file from maven command line

From Dev

How to execute jar file with a external dependency using command line on Windows?

From Dev

How to execute a command with each GREP result while TAILING a file

From Dev

How to execute a Zim Database file from command line?

From Dev

How to create new command to execute a batch file with Sublime Text?

From Dev

How to interrupt a running Batch file, execute a command in its environment, then continue?

From Dev

How to execute jar file with a external dependency using command line on Windows?

Related Related

  1. 1

    How to direct to file folder and execute specific file using batch command

  2. 2

    PowerShell - How to execute BAT (batch) command on specific file? (Concatenate path and command and propagate arguments )

  3. 3

    How to execute a specific command on opening a terminal

  4. 4

    How do I execute a command on a specific screen?

  5. 5

    How execute specific command from shell script

  6. 6

    How to execute command on list of file names in a file?

  7. 7

    (All variants) How to execute specific command with any command entered?

  8. 8

    How to execute one specific command from history command?

  9. 9

    How to execute a command/script after a specific command was executed?

  10. 10

    How to DIRECTLY execute command in txt file in cmd?

  11. 11

    How to execute cmd command from text file?

  12. 12

    How to execute and save result of an OS command to a file

  13. 13

    How to execute a mongo command in sh file?

  14. 14

    How to execute a command whenever a file changes?

  15. 15

    How to execute source command from sh file

  16. 16

    Execute command for a specific output of a command

  17. 17

    Execute a command in a separate file

  18. 18

    How to convert and Execute lib_file.a Library file in Command prompt?

  19. 19

    How to create a file with specific command to run in linux?

  20. 20

    How to redirect output to a specific file into a sed command?

  21. 21

    Execute command on specific screen on CentOS

  22. 22

    How can I execute a script as root, execute some commands in it as a specific user and just one command as root

  23. 23

    How to execute a java class file from maven command line

  24. 24

    How to execute jar file with a external dependency using command line on Windows?

  25. 25

    How to execute a command with each GREP result while TAILING a file

  26. 26

    How to execute a Zim Database file from command line?

  27. 27

    How to create new command to execute a batch file with Sublime Text?

  28. 28

    How to interrupt a running Batch file, execute a command in its environment, then continue?

  29. 29

    How to execute jar file with a external dependency using command line on Windows?

HotTag

Archive