From 97204e1cef4f922cc1f8e67f8a1f2f695d7da826 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 30 Sep 2016 02:33:50 +0200 Subject: os/shell: Throttle :! output, pulse "..." message. Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly improves responsiveness when :! spams MB or GB of output: :!yes :!while true; do date; done :!git grep '' :grep -r '' * After ~10KB of data is seen from a single :! invocation, output will be skipped for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the behavior alternates at every: * 10KB received * ~1s throttled This also avoids out-of-memory which could happen with large :! outputs. Note: This commit does not change the behavior of execute(':!foo'). execute(':!foo') returns the string ':!foo^M', it captures *only* Vim messages, *not* shell command output. Vim behaves the same way. Use system('foo') for capturing shell command output. Closes #1234 Helped-by: oni-link --- runtime/doc/various.txt | 12 +++++++++--- runtime/doc/vim_diff.txt | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index a1bf379d86..625416146e 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -255,14 +255,20 @@ g8 Print the hex values of the bytes used in the backslashes are before the newline, only one is removed. - On Unix the command normally runs in a non-interactive - shell. If you want an interactive shell to be used - (to use aliases) set 'shellcmdflag' to "-ic". + The command runs in a non-interactive shell connected + to a pipe (not a terminal). Use |:terminal| to run an + interactive shell connected to a terminal. + For Win32 also see |:!start|. After the command has been executed, the timestamp and size of the current file is checked |timestamp|. + If the command produces a lot of output the displayed + output will be "throttled" so the command can execute + quickly without waiting for the display. This only + affects the display, no data is lost. + Vim redraws the screen after the command is finished, because it may have printed any text. This requires a hit-enter prompt, so that you can read any messages. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index c4795bec57..1940bc55fa 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -155,6 +155,11 @@ are always available and may be used simultaneously in separate plugins. The |system()| does not support writing/reading "backgrounded" commands. |E5677| +Nvim truncates ("throttles") shell-command messages echoed by |:!|, |:grep|, +and |:make|. No data is lost, this only affects display. This makes things +faster, but may seem weird for commands like ":!cat foo". Use ":te cat foo" +instead, |:terminal| output is never throttled. + |mkdir()| behaviour changed: 1. Assuming /tmp/foo does not exist and /tmp can be written to mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and /tmp/foo/bar -- cgit