0

I'm using the stock terminal with zsh and vim. After I exit vim, the file contents remains in the terminal. Ideally, only the previous history would be in the terminal when I exit vim (such as the behavior I've seen with linux/bash).

How can I accomplish that?

Update

I'm running os x Yosemite 10.10.1

I tried glenn jackman's suggestion below, but still no dice.

Additional information:

echo $TERM produces ansi

I also tried in bash with the same results.

I also tried removing .vimrc completely with the same results.

  • Weird. On my Lion system, running vim under zsh nets the usual exit, i.e., the file contents are not visible. – Trane Francks Jan 25 '15 at 3:07
  • Try setting TERM=xterm in the shell before opening vim. – Gordon Davisson Jan 27 '15 at 0:30
1

I figured it out:

Similar to glenn jackman's solution, I added

if &term =~ "ansi"
    let &t_ti = "\<Esc>[?47h"
    let &t_te = "\<Esc>[?47l"
endif

to my .vimrc file (notice the ansi instead of xterm).

This fixed the issue.

1

Try adding:

if &term =~ "xterm"
    let &t_ti = "\<Esc>[?47h"
    let &t_te = "\<Esc>[?47l"
endif

to your ~/.vimrc

Ref: https://forums.vandyke.com/showthread.php?t=3431

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .