[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [screen-devel] [PATCH] process: add RC_ADOPTWD adopt working directo
From: |
vcaputo |
Subject: |
Re: [screen-devel] [PATCH] process: add RC_ADOPTWD adopt working directory |
Date: |
Wed, 8 Nov 2017 18:02:06 -0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Wed, Nov 08, 2017 at 08:08:44PM +0100, Amadeusz Sławiński wrote:
> On Wed, 8 Nov 2017 10:55:20 -0800
> address@hidden wrote:
>
> > On Wed, Nov 08, 2017 at 06:48:22PM +0100, Amadeusz Sławiński wrote:
> > > On Tue, 31 Oct 2017 19:30:35 -0700
> > > Vito Caputo <address@hidden> wrote:
> > >
> > > > s is an RC_CHDIR convenience helper which discovers the working
> > > > directory of the foreground window.
> > >
> > > Hey,
> > >
> > > I'm not sure about this patch, seems to be overly linux specific to me.
> > >
> > > Also, you can have nested shells, which will probably make it behave in
> > > ways you don't expect it to behave (by changing to parent directory
> > > instead of childs).
> > >
> > > Amadeusz
> >
> > Is there a way to achieve the same thing purely through runtime
> > configuration?
> >
> > If not, perhaps just a minimum of extension can be done to make that
> > possible in a more OS-agnostic way.
> >
> > Assigning a key to perform RC_CHDIR on a string acquired from an external
> > command which can be fed the PID of the foreground window's process through
> > a configurable format string is the kind of thing I'm imagining. Then in
> > my use case I'd just do the linux-specific assume-no-subshells /proc-based
> > introspection in the external command referenced in my config.
> >
> > If this is already possible, please let me know, thanks.
> >
> > Regards,
> > Vito Caputo
>
> Hey,
>
> I wrote quick shell function, seems to work both with bash and zsh
>
> cd () {
> builtin cd $@
> if [[ ${STY} ]]; then
> screen -S "${STY}" -X chdir ${PWD}
> fi
> }
>
> and does it automatically, ie you don't need to run some shortcuts etc.
>
That's useful, I'm not sure about overloading `cd` to always keep screen's
CWD in sync, but perhaps a distinctly named alternative will suffice.
I'd still like the ability to configure an interactive control for
introspecting this so it could be done asynchronously on a window
regardless of what that window is running (if I'm already in vim in the
desired dir, for example).
It's normal for me to be jumping around in a project's directory heirarchy
and expect all new windows to be created at that project's root. It's when
I happen to migrate into another project (usually a dependency or
something), but without starting a new screen session, that I tend to use
the RC_ADOPTWD functionality on the new project's root.
Not a big deal, and thanks for the quick responses.
Regards,
Vito Caputo