Until recently I have been using bash with tmux. Bash was behaving as I would expect it to behave, where the history is preserved in each separate pane, and is not shared between panes. However it looks like in zsh the default is for the history in the panes is to be shared. Is there a way to overwrite the default in zsh so that they are not shared when using in tmux?
copy-mode is the way to view history (and optionally copy stuff out of it). Just run: echo "set -g mouse on" >> ~/. tmux. conf and you'll be able to scroll.
Switching between panes To get from one pane to another, press Ctrl+B followed by O (as in other).
Tmux uses the keybinding 'Prefix' followed by 'Ctrl+o' to cycle around the panes. When you use this key-binding for the first time, it moves the pane in one position clockwise.
To close a pane, first ensure that you're positioned in it. Then type "exit" or Ctrl-d. Note that there is no need for Ctrl-b in this step. Once you type "exit" or Ctrl-d in the last remaining pane, tmux will close.
Tmux should have nothing to do with this, really. So let's focus on your Zsh setup.
You’d have to jump through some hoops to get history to be real-time shared among running Zshs, so it’s surprising that you’re seeing this. What settings have you made to control your Zsh history? Run this to see your settings:
setopt |grep hist
For not saving history immediately, you’ll want:
setopt noincappendhistory setopt nosharehistory
You can put that into your ~/.zshrc
. You may want to log out of running shells to ensure your new settings take place.
For info on all the history-related Zsh options, see man 1 zshoptions
and look for the “History” section a few pages in. Note that there are also some environment variables that impact history (SAVEHISTORY
, HISTFILE
, HISTFILEIGNORE
, HISTSIE
, HISTFILESIZE
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With