bash - Capture output of last executed command into a variable without affecting Vim and line returns -


from question: bash - automatically capture output of last executed command variable used command:

prompt_command='last="`cat /tmp/x`"; exec >/dev/tty; exec > >(tee /tmp/x)' 

it works, when use vim this:

# vim vim: warning: output not terminal 

then vim opens. takes while. there way rid of message , slowdown?

also when list dir , echo $last removes return lines (\n). there way keep return lines (\n)?

i think ask hard achieve. vim tests if output terminal. command you've provided redirects output tee command. tee saves input (which menans: command's output) file and outputs terminal. vim knows nothing it. knows output not terminal. outputs warning. , vim's source code:

[...] if (scriptin[0] == null)     ui_delay(2000l, true); time_msg("warning delay"); 

which means redirection 2 seconds delay.

also, example, man vim command not work such redirections, because terminal output has attributest (e.g. width , height) generic file hasn't. so... won't work.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -