Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to not share history between panes/windows in tmux with zsh?

Tags:

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?

like image 544
Hristo Asenov Avatar asked Aug 17 '15 19:08

Hristo Asenov


People also ask

How do I view tmux history?

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.

How do I navigate between tmux Windows?

Switching between panes To get from one pane to another, press Ctrl+B followed by O (as in other).

How do I switch between tmux panes?

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.

How do I close tmux panes?

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.


1 Answers

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).

like image 63
Micah Elliott Avatar answered Sep 27 '22 23:09

Micah Elliott