remi / teamocil

There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.
MIT License
2.35k stars 101 forks source link

Why the working directory is not set correctly? #68

Closed kamelzcs closed 10 years ago

kamelzcs commented 10 years ago

After using teamocil tc, the working directory changed to /home/kamel/.oh-my-zsh/plugin/tmux, not the intended /home/kamel/Code/study

.tmux.config file

set -g default-terminal "screen-256color"
# zsh is kinda tight
set-option -g default-shell $SHELL

# look good
#set -g default-terminal "screen-256color"

# act like GNU screen
unbind C-b
set -g prefix C-a

# Make shift+arrows, ctrl+arrows etc work in Vim.
set -g xterm-keys on
# See if this fixes slow ESC issues.
# http://unix.stackexchange.com/questions/23138/esc-key-causes-a-small-delay-in-terminal-due-to-its-alt-behavior
set -s escape-time 0

# a mouse
set -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on

# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"

# Maximize pane, e.g. for copying.
bind-key z resize-pane -Z

# Reload tmux conf.
unbind r
bind r source-file ~/.tmux.conf\; display "Reloaded conf."

# move x clipboard into tmux paste buffer
bind C-p run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind C-y run "tmux save-buffer - | xclip -i"
# after copying to a tmux buffer, hit y again to copy to clipboard
#### COLOUR (Solarized 256)

# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default

# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim

# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright

# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01

# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange

# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange

# clock
set-window-option -g clock-mode-colour colour64 #green

tmux --debug tc:

tmux rename-session 'teamocil-session-126108' tmux new-window -n 'TC' -c '/home/kamel/Code/study' tmux send-keys -t 1 'vim' tmux send-keys -t 1 'Enter' tmux split-window -c '/home/kamel/Code/study' tmux send-keys -t 2 'whoami' tmux send-keys -t 2 'Enter' tmux split-window -c '/home/kamel/Code/study' tmux send-keys -t 3 'ls' tmux send-keys -t 3 'Enter' tmux select-layout 'ba8a,211x49,0,0{165x49,0,0,19,45x49,166,0[45x14,166,0,21,45x34,166,15,22]}' tmux select-pane -t 1

teamocil1

remi commented 10 years ago

If you run these commands in tmux, what does it do:

$ tmux new-window -n 'TC' -c '/home/kamel/Code/study'
# And then in the newly created window:
$ tmux split-window -c '/home/kamel/Code/study'

It’s supposed to open a new window with two horizontal splits, each of them opened at /home/kamel/Code/study.

kamelzcs commented 10 years ago

Finally, I found the problem, it is due to the conflict with oh-my-zsh plugin tmux After I disabled the plugin, it will not jump to /home/kamel/.oh-my-zsh/plugin/tmux directory, but the directory will not change, it will remain as it was.

# start directory is '/home/kamel/dotConf'
$ tmux
$ tmux new-window -n 'TC' -c '/home/kamel/Code/study'
$ tmux split-window -c '/home/kamel/Code/study'

teamocil

remi commented 10 years ago

Alright, I’m going to close the issue then as teamocil just execute tmux commands. Thanks!