When running Screen, I can use Ctrl+ac to create a new window and run vim in each window. Also from Screen, I can run the command screen vim
multiple times to open new windows with vim already running. These work as expected. However...
If I put the command multiple times in a script, such as:
#!/bin/bash
screen vim
screen vim
screen vim
...and run that script from within Screen, the first command will run as expected, but the second and following ones will not.
Things I have noticed are:
- Window 2 and beyond does not have
stty -ixon
applied, which I have set in .bashrc - If I don't have
colorscheme
set explicitly in .vimrc, it will use one scheme in window 1 and another in all following windows - Sometimes a command will be skipped, i.e., sometimes only two new windows will be opened where the script was set to open three
- If I do a
:windowlist
, window 2 and following will not have the login flag set (runningscreen vim
directly will set this flag), e.g.,
Num Name Flags 0 bash $ 1 vim $ <-- running the script from window 0 opened 1..3 (no flag on 2 or 3) 2 vim 3 vim 4 vim $ <-- manually running `screen vim` from window 0 always sets the flag
- Using Ctrl+aL on a window that's not logged in will return the message
This window is not logged in
and the flag will not be set. Pressing the keys again will then toggle between logged in and out (thoughstty -ixon
etc' will still not be applied) - Running
htop
will show all instances of vim (including ones that are not logged in) are running under my user.
Why does manually opening multiple windows apply my settings correctly, but using a script doesn't?
I am new to Linux and not sure if I'm doing something silly here.