tmuxp
tmuxp copied to clipboard
environment option not work on PATH variable
I am trying to load the PATH variable in a tmuxp session and this variable should be available in any new window of the session:
global_options:
default-command: /bin/bash
environment:
EDITOR: /usr/bin/vim
PATH: ${PATH}$HOME/.config/myproj/
session_name: myproj
windows:
- window_name: main-dev
focus: true
layout: horizontal
panes:
- shell_command:
- printf '\033]2;%s\033\\' 'Editor'
focus: true
${PATH}$HOME/.config/myproj/ it only loads in the current window but when a new window is created the variable disappears while EDITOR is loaded in any new window and does not disappear
Step 2: Provide tmuxp details
- Python 2.7.6
- system PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/bin/core_perl:/usr/games/bin:/home/robot/.local/bin:/root/.gem/ruby/2.3.0/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/android-sdktools/:/opt/android-sdkplatform-tools/:
- tmux 2.9a
- tmuxp 1.5.1
- tmux /usr/bin/tmux
- tmuxp ~/.local/bin,
- libtmux ?
- shell bash
- output of
`myproj: 2 windows (created Tue May 14 01:26:02 2019) (attached)`,
'0: main-dev* (1 panes) [210x50] [layout acde,210x50,0,0,1] @1 (active)`,
`0: [210x50] [history 42/2000, 30200 bytes] %1 (active)'
- output of
tmux show-options -g
:
@plugin "tmux-plugins/tmux-sensible"
activity-action other
assume-paste-time 1
base-index 0
bell-action any
default-command "/bin/bash"
default-shell "/bin/bash"
default-size "80x24"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 4000
history-limit 50000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-titles off
set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
silence-action other
status on
status-bg green
status-fg black
status-format[0] "#[align=left range=left #{status-left-style}]#{T;=/#{status-left-length}:status-left}#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#{T:window-status-format}#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{window-status-current-style},default},#{window-status-current-style},#{window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#{T:window-status-current-format}#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{status-right-style}]#{T;=/#{status-right-length}:status-right}#[norange default]"
status-format[1] "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
status-interval 5
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment[0] "PATH"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"
, tmux show-window-options -g
aggressive-resize on
allow-rename off
alternate-screen on
automatic-rename on
automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
clock-mode-colour blue
clock-mode-style 24
main-pane-height 24
main-pane-width 80
mode-keys vi
mode-style fg=black,bg=yellow
monitor-activity off
monitor-bell on
monitor-silence 0
other-pane-height 0
other-pane-width 0
pane-active-border-style fg=green
pane-base-index 0
pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
pane-border-status off
pane-border-style default
remain-on-exit off
synchronize-panes off
window-active-style default
window-size smallest
window-status-activity-style reverse
window-status-bell-style reverse
window-status-current-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-current-style default
window-status-format "#I:#W#{?window_flags,#{window_flags}, }"
window-status-last-style default
window-status-separator " "
window-status-style default
window-style default
wrap-search on
xterm-keys on
- output of
tmuxp freeze <SESSION_NAME>
session_name: myproj
windows:
- focus: 'true'
layout: acde,210x50,0,0,1
options:
automatic-rename: 'off'
panes:
- focus: 'true'
shell_command: bash
start_directory: /home/robot
window_name: main-dev
Step 3: Describe your environment
- Architecture: x86_64 GNU/Linux
- OS version: Arch Linux 5.0.11-arch1-1-ARCH
Step 4: Describe the problem:
Steps to reproduce:
- create dev.yam file
- tmuxp load dev.yaml
- in the current window: echo $PATH and echo $EDITOR the variable $HOME/.config/myproj/ appears $EDITOR show "vim" ctrl+b+c //new window in new windows: echo $PATH and echo $EDITOR the variable $HOME/.config/myproj/ does not appears $EDITOR show "vim"
Observed Results:
- the $HOME/.config/myproj/ variable is not displayed in new windows
Expected Results:
- that the $HOME/.config/myproj/ in PATH variable can be accessed from any created window, just like the variable EDITOR
I had the same issue with 1.5.4. Then I upgrade to 1.6.2 to see if it was fixed but no :( but I found that doing the following works:
session_name: myproject
shell_command_before:
- PATH=$PATH:$(pwd)/bin/
- '[ -d `pipenv --venv` ] && source `pipenv --venv`/bin/activate && reset'
- nvm use default
windows:
...
That is my workaround, not sure how accurate that is but it works for me :) I hope it can be helpful for someone.
Note: As you can see I'm using pipenv and nvm here, and I need to place the PATH instruction first otherwise it will get overwritten by pipenv and nvm
@boertel Happy that you were able to find a workaround
For both you and @joselbr2099 (and anyone else who bumps into this):If we had this recreated in a test PR (to recreate the issue), that would be ideal (I could write a fix for it)