从编辑器(vim/nano/emacs/textmate?)获取输入

Nil*_*ann 4 shell zsh input

我只是好奇,如果有办法从中获取输入不StdIn但是从$EDITOR-无论是Vim的纳米,emacs的,甚至非命令行编辑器(的MacVim / TextMate的)。有哪些选项/解决方法/最佳实践?

基本上我希望像这样的工作流程heredoc- 但是来自 $editor 。

$ sort -nr << FOO | uniq -c 
pipe heredoc> foo 
pipe heredoc> bar
pipe heredoc> baz
pipe heredoc> foo
pipe heredoc> FOO
   2 foo
   1 baz
   1 bar
Run Code Online (Sandbox Code Playgroud)

don*_*lly 7

moreutilsvipe包中的命令允许您在管道中间启动 $EDITOR。 您可以像这样获得所需的行为:

$ </dev/null vipe |sort -nr | uniq -c 
Run Code Online (Sandbox Code Playgroud)