I am kind of a Vim novice. I would like to send contents of the current buffer to stdin of external command (lets say mail). My final purpose is to set a shortcut to quickly send email from current Vim buffer. I am guessing this should be a trivial stuff, but I couldn't find a way to send Vim buffer to an external command. Thanks in advance.
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Problem with piping commands in C
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- Unix FIFO in go?
- How to copy the value of a vim option to a registe
You can use
:w !cmd
to write the current buffer to the stdin of an external command. From:help :w_c
:A related command is
:%!cmd
which does the same thing and then replaces the current buffer with the output of the command. So:%!sort
would invoke the external sort command to sort the current buffer in place.Here is example how to send the current buffer to external stdin from the command line:
It's useful for scripting purposes.
For more command-line tricks, check: