On Thu, Sep 24, 2009 at 6:59 PM, Gary Johnson wrote: > > On 2009-09-24, viki wrote: >> On Sep 23, 6:22 pm, Gary Johnson wrote: >> > On 2009-09-23, viki wrote: > >> > > In fact, I want to have the usual screen flipping AND I want to see >> > > the final :!echo printouts. The strange thing happens with :!echo. >> > > They are not seen when in Vimleave. They are printed in the >> > > curses-mode screen, which is weird. In all other places in vim, >> > > :!echo is printed in "shell-screen". >> > >> > > Is it a vim bug ? I'd prefer a vim function that prints to "original >> > > screen". >> > >> > > I tried to add set t_ti= t_te= to the PrintAtExit() function, this did >> > > not help me. >> > >> > It's not a bug. >> >> I refer to the :!echo, the shell command execution. >> In vimscript, :!echo writes to *original* screen (unlike :echo). >> When doing :!echo, vim switches to original screen, does system(), >> switches back to alternate screen. Results of :!echo always appear on >> *original* screen. Always, except for au VimLeave. This "except" is >> what has smell of a bug. > > I stand corrected. I was sure that vim behaved as I described, > writing the results of a shell command to the alternate screen > without switching, just as it does to the normal screen when > alternate screen switching is disabled. That would leave the > original screen as it was before vim was executed. Instead, it > switches to the alternate screen just as you describe. Vi on HP-UX > 11 and on SunOS 5.8 behave the same way. > >> Can you explain why in au VimLeave, when vim still operates in >> alternate screen, :!echo does not write to normal screen as in the >> rest of vim ? > > If vim's behavior is a bug, it's not just in the processing of the > VimLeave event but in that of all autocommand events. At least the > ones I tested. Try this: > > vim -N -u NONE > :au BufNew * !echo hello > :new > :qa > > Nothing is written to the original screen. As I said, this is how I > though shell commands always worked, even from the command line. I > don't know whether this behavior is intentional or not. I couldn't > find anything about it in the help files.
In any event, the OP can just interpolate &t_te into his autocmd to get the behavior he wants. This works for me (on Unix, of course): au VimLeave * exe '!echo; echo ' . shellescape(&t_te . 'GOODBYE') ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
