0

I'd like to set up screen to open a specific set of files for editing at startup.

I'd like to have something like this in ~/.screenrc:

chdir /home/andrew/scripts/
screen -t scripts gvim script1.sh
chdir /home/andrew/scratch/
screen -t test

I can't seem to get gvim to open any files, or my screen to stay alive after the gvim opens and detaches.

ajwood
  • 18,227
  • 15
  • 61
  • 104
  • `gvim` is a graphical program, are you sure you do not mean `vim`? To get `gvim` to run, you need to supply a valid `DISPLAY` variable, probably set to `:0`. You should be able to do what you ask with: `screen -t scripts DISPLAY=:0 gvim script1.sh`. – Thor Aug 16 '12 at 15:55
  • Ideally it would do gvim if possible, and use vim if it couldn't get a display. – ajwood Aug 16 '12 at 16:53
  • That gives me `Cannot exec 'DISPLAY=': No such file or directory` – ajwood Aug 16 '12 at 16:54
  • I can fix that by using `setenv` before making the screen, but the screen dies as soon as the gvim detaches. – ajwood Aug 16 '12 at 16:57
  • Right, I was wrong about prepending variables, that doesn't work here. I can't reproduce the problem you describe, using your `screenrc` file everything runs as expected. I get a `scripts` and a `test` window. – Thor Aug 16 '12 at 20:27
  • My `scripts` windows terminates immediately. – ajwood Aug 16 '12 at 20:44

0 Answers0