TMUX: how to make a new window stay when you run a shell command?

In tmux command line mode, the following creates a new window and opens vim inside:

:new-window vim

When you exit vim, the window also closes. Is there any way to make him stay?

+5
source share
3 answers

tmuxhas the ability to do this remain-on-exit:

tmux set remain-on-exit on
+14
source

I understand that this is a long dead question. But I am a recent tmux user, and I had the same question. Turns out you can do this:

tmux new-session bash -l 

bash ( ). , . , , . , "" . .

+3

I use send-keys so that it "injects" the command into the shell. Here is my get.allscript that runs many commands, some of which I may need after completion (and those that I don’t have) 21>):

#!/bin/sh
tmux att -t get ||
tmux \
  new -s get -n emacs \; \
  send-keys 'get.emacs' C-m \; \
  neww -n git \; \
  send-keys 'get.git' C-m \; \
  neww -n mini \; \
  send-keys 'get.mini' C-m \; \
  neww -n port \; \
  send-keys 'get.port' C-m \; \
  neww -n rakudo \; \
  send-keys 'get.rakudo' C-m \; \
  neww -n neil \; \
  send-keys 'get.neil && get.neil2 && exit' C-m \; \
  neww -n red \; \
  send-keys 'get.red && exit' C-m \; \
  neww -n cpan \; \
  send-keys 'get.cpan && exit' C-m \; \
  selectw -t emacs
0
source

All Articles