0

when entering tmux, my default shell becomes Oh My Zsh which is fine.

However as a result before every command for tmux I have to type "tmux" but every single tutorial i am viewing doesn't have that?

for my conf file I also need the "tmux" before any of it runs, previously it doesn't run when i start a new tmux session.


# unbind default prefix and set it to ctrl-a
tmux unbind C-b
tmux set -g prefix C-a
tmux bind C-a send-prefix

# make delay shorter
tmux set -sg escape-time 0


#### key bindings ####
#split panes using | and - 
tmux bind | tmux split-window -h 
tmux bind - tmux split-window -v 
tmux unbind '"' 
tmux unbind %

Thanks in advance!

Marlon Richert
  • 2,029
  • 3
  • 18
  • 1
    "for my conf file" -- What file exactly? – Kamil Maciorowski Jul 06 '21 at 11:29
  • 2
    It *is* normal to have to type `tmux` before any tmux command performed in the shell (e.g. `tmux list-commands`). Otherwise, how would the shell know that the subcommand was meant for `tmux`? To execute tmux commands in the shell without that, the prefix keybindings are used (normal Ctrl+b, but you are trying to set it to Ctrl+a, which I like as well). However, it is *not* normal to have to prefix the config file commands with `tmux`. As @KamilMaciorowski asked, to which config are you referring? This would be expected if it was a `zsh` config, but not for the `~/.tmux.conf`. – NotTheDr01ds Jul 06 '21 at 14:54
  • @KamilMaciorowski it is my ```~/.tmux.conf``` file @NotTheDr01ds my shell becomes zsh automatically after i open up a new tmux session and then without the ```tmux``` prefix inside the ~/.tmux.conf file i cant load the changes or they are not registered. – itachi_chi Jul 07 '21 at 02:46
  • `~/.tmux.conf` is parsed by tmux [when tmux server starts](https://superuser.com/a/1287433) or on demand with `source-file ~/.tmux.conf` tmux command (or semi-equivalent `tmux source-file ~/.tmux.conf` *shell* command). It doesn't run when you start a new tmux session, unless the new session starts a new server. This is by design. If you made it work by adding `tmux` to everything and sourcing from a shell (e.g. `. ~/.tmux.conf`) then this is wrong. Did you source it from a shell? The file is not designed to be sourced by a *shell*. I don't think your file works when properly sourced by tmux. – Kamil Maciorowski Jul 07 '21 at 08:47
  • Thank you. I think I do understand the part of the sourcing part, which explains my problem. However, how do I check if the file sourced is sourced properly by tmux or in my case how do I change it to be sourced by tmux. I think I created the ```~/.tmux.conf``` manually too, as it wasn't there, to begin with so I was a little lost following tutorial. – itachi_chi Jul 07 '21 at 13:14
  • "how do I change it to be sourced by tmux?" -- tmux should source the file automatically [when a server starts](https://superuser.com/a/1472783/432690). Your file won't do what you want because you added these `tmux ` prefixes. In a shell inside tmux run `tmux source-file ~/.tmux.conf` and you will see multiple `unknown command: tmux`. The messages will be about the prefixes in the file. Remove the prefixes. If after this `tmux source-file ~/.tmux.conf` does not complain and brings the desired effect(s) then the same should happen when tmux loads the file automatically when a server starts. – Kamil Maciorowski Jul 07 '21 at 14:04

0 Answers0