At the beginning

Vim has the :wand :rcommands. I think many people know the command itself.
It’s a little convenient for me, so I’ll introduce it.


:r banana.txtWill read the contents of the file and insert it on the next line of the current cursor.
You can also specify the lines that can be inserted. In that case :{lnum}r banana.txt, enter the line number at the beginning.

This is the best choice, but you can actually :r !{cmd}insert the command output with.
This is useful, for example, if you want to edit the API response a bit with Vim, or if you want to insert the command execution result into an article.


:wThis is a command that everyone in Vimmer knows about, so I won’t explain it, but in
fact :w !{cmd}, it passes the contents of the buffer as standard input for external commands.

In other words, if you have an interpreter that can receive code from standard input and execute it, you can execute code pieces quickly
without saving each file .

For example, :w !nodeyou can execute JavaScript code, and you can :w !bashexecute shell scripts.

Actually, when you execute the sample code , the result will be output.

:rAnd the :wcombination of

By combining these two commands, you can stop docker containers at once in Vim.

For more information on these two types of command :h :rcapital :h :wPlease refer to.
All the contents explained are written.


:rAnd :wconvenient.