I think there might be pane_start_path as well which would work for you.

-------- Original message --------
From: Matteo Cavalleri <shivabra...@gmail.com> 
Date: 27/02/2014  22:28  (GMT+00:00) 
To: Nicholas Marriott <nicholas.marri...@gmail.com> 
Cc: tmux-users@lists.sourceforge.net 
Subject: Re: problem with new-window and current directory 
 
well, from my point of view (and the way i usually work) that won’t be a 
problem at all, and in any case I think it would still better the be back at 
"/the/dir/I/was/in/before/running/whatever” rather than being put on “/“ and 
then having to manually cd back to the correct dir

anyway I understand other people might think different, but I suppose that it 
could still be configurable, e.g.

bind-key c new-window -c '#{pane_current_path} -> current behavior
bind-key c new-window -c ‘#{$PWD} -> suggested behavior

or maybe fallback to $PWD if the process directory is empty (not sure if Thomas 
Adam meant that when he talked about subshells)



> But what if the process changes the directory? We can tell the pwd where
> we start the command but not if it changes it.
> 
> 
> On Thu, Feb 27, 2014 at 11:14:42PM +0100, Matteo Cavalleri wrote:
>> too bad :( just curious: why not e.g. evaluate $PWD when executing the 
>> command? it seems to be expanded just when the config is loaded and then the 
>> value is kept as is.
>> 
>> 
>> 
>>> The mechanism is not always reliable, not sure there is much we can do 
>>> about it.
>>> 
>>> 
>>> -------- Original message --------
>>> From: Matteo Cavalleri <shivabra...@gmail.com> 
>>> Date: 27/02/2014 21:09 (GMT+00:00) 
>>> To: tmux-users@lists.sourceforge.net 
>>> Subject: problem with new-window and current directory 
>>> 
>>> 
>>> Hi, i?m using tmux 1.9a on osx and I have the following problem when i 
>>> create a new window.
>>> 
>>> in my .tmux.config:
>>> 
>>> bind-key c new-window -c '#{pane_current_path}?
>>> 
>>> steps to reproduce the problem
>>> 
>>> $ cd
>>> $ tmux
>>> $ cd /usr/local
>>> 
>>> C-b c -> creates a new window in /usr/local
>>> 
>>> $ exit # closes the new window and go back to the first one
>>> $ less /etc/hosts
>>> 
>>> C-b c -> creates a new window in /usr/local
>>> 
>>> $ exit
>>> $ cat /etc/hosts | less # the pipe is important here
>>> 
>>>
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to