On 2013-01-02, Aaron Davies wrote:
> is there a way to get vim to not clear the screen only on specific
> basically i want to use vim to print syntax-highlighted code on a
> color printer. "vim +ha +q foo.c" works nicely, but on some systems,
> it has the side-effect of clearing the screen and leaving the cursor
> at the bottom line, while on others, it makes a big annoying flash as
> the screen redraws, then restores.
> ideally i'd like something i could pass as an option that would
> completely turn off the redraw behaviors for that specific run.
This behavior uses the terminal's alternate screen. See
for a brief discussion of this. Whether the alternate screen is
used depends on the capabilities of the terminal you are using, the
capabilities advertised by the terminfo or termcap database, whether
the feature is enabled or disabled in the terminal, and the setting
of Vim's 't_te' and 't_ti' options.
As an example of how this behavior can be controlled, I usually like
to have Vim leave its display on the terminal screen when it exits,
but not when I'm using it to edit a bash command line, so I have
this in my ~/.vimrc:
if argv(0) !~ '^/tmp/bash-fc-\d\+$'
set t_ti= t_te= " Disable screen switching
" unless Vim is being used to edit a
" bash command line. In that case,
" we don't want Vim to screw up the
" Only the new color xterm and rxvt
" seem to allow this. See ":help
" xterm-screens". This can be
" disabled within xterm itself via
" the titeInhibit resource, but that
" still leaves extra characters on
" the screen when vim exits.
" Setting these here also cleans up
" those characters.
au BufWinEnter * if &ft == "" | set ft=sh | endif
I also have a script at work (so I can't refer to it at the moment)
that contains these lines:
where smcup and rmcup are the terminfo equivalents of t_ti and t_te,
which also causes the screen to be restored after Vim exits. See
the terminfo(5) man page.
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php