vi editor is overwriting the console commands history

184 views Asked by At

When using the linux screen, vi editor overwrites all console information. I expect vi to open the file as a separate window and on exit, it has to return back to console.

My .screenrc is,

################
#
# default windows
#
screen -t screen1 1
screen -t screen2 2
screen -t screen3 3
screen -t screen4 4
screen 1

# caption always "%3n %t%? @%u%?%? [%h]%?%=%c"
# hardstatus alwaysignore
# hardstatus alwayslastline "%Lw"
#hardstatus string "[screen %n]:%h"


hardstatus on
hardstatus alwayslastline

hardstatus string '%{= wk}%-w %{bw} [ %n %t ] %{Kd}%+w %-= %{KY} | %D %M %d %Y% | %C %A %{-} '




#caption always
#caption string "%{= bW}%3n %{y}%t %{-}%= %{m}%H%?%{-} -- %{c}%l%?%{-} -- %D %M %d %{y}%c"

#term screen-256color
attrcolor b ".I"    # allow bold colors - necessary for some reason
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'   # tell screen how to set colors. AB = background, AF=foreground
defbce on    # use current bg color for erased chars

vbell  off
1

There are 1 answers

4
gaganshera On

Screen does that. When opening a vi editor in screen, it will appear on the screen pushing back all the log on the console. Also, you cannot scroll back while checking a log on screen for similar reason. However, every screen has a log file. It logs to screenlog.%n by default, where %n is the screen window number. In your .screenrc file, you can check/change this log file's path. To start logging, start the screen using screen -L command.

To emulate what you need, open a new terminal tab and do a tail -f screenlog.0. This will give you the live updated log from your screen.

---Edit---

If you're comfortable with shifting to a new application, try tmux. It should do exactly what you need. Read this for more info.