diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-27 13:35:36 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-27 17:36:32 -0300 |
commit | e995b2156778fb28f1fbcf29a97d3f7f531e7583 (patch) | |
tree | 9049279ccadfaf1a6d429a4e3a46f5410f78afe0 /src/ex_cmds.c | |
parent | 1e8eb4e2c6f75b12d863e52ded56ccd48b5c8769 (diff) | |
download | rneovim-e995b2156778fb28f1fbcf29a97d3f7f531e7583.tar.gz rneovim-e995b2156778fb28f1fbcf29a97d3f7f531e7583.tar.bz2 rneovim-e995b2156778fb28f1fbcf29a97d3f7f531e7583.zip |
Re-integrate FEAT_FILTERPIPE code
This feature was accidentally removed when doing the initial import from vim. It
makes vim use pipes instead of temporary files for filtering buffers through
shell commands.
I found that this was missing when looking for references of
SHELL_READ/SHELL_WRITE outside mch_call_shell`.
When `mch_call_shell` is reimplemented on top of libuv process management
facilities, pipes will always be used for communication with child processes so
it makes sense to enable the feature permanently.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index b0919f3b30..d0e4c9eccd 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1024,7 +1024,23 @@ do_filter ( if (do_out) shell_flags |= SHELL_DOOUT; - if ((do_in && (itmp = vim_tempname('i')) == NULL) + if (!do_in && do_out && !p_stmp) { + // Use a pipe to fetch stdout of the command, do not use a temp file. + shell_flags |= SHELL_READ; + curwin->w_cursor.lnum = line2; + } else if (do_in && !do_out && !p_stmp) { + // Use a pipe to write stdin of the command, do not use a temp file. + shell_flags |= SHELL_WRITE; + curbuf->b_op_start.lnum = line1; + curbuf->b_op_end.lnum = line2; + } else if (do_in && do_out && !p_stmp) { + // Use a pipe to write stdin and fetch stdout of the command, do not + // use a temp file. + shell_flags |= SHELL_READ|SHELL_WRITE; + curbuf->b_op_start.lnum = line1; + curbuf->b_op_end.lnum = line2; + curwin->w_cursor.lnum = line2; + } else if ((do_in && (itmp = vim_tempname('i')) == NULL) || (do_out && (otmp = vim_tempname('o')) == NULL)) { EMSG(_(e_notmp)); goto filterend; |