Thanks Riccardo.

I also use Vim but I think the problem there is somewhat different. The Vim
process will have an OS maintained cwd according to /proc/PID/cwd but Vim
itself also maintains a 'current directory' that can be varied using :cd

It would definitely be a stretch goal to have awesome spawn a terminal
using the :cd from Vim in the currently active window (this would probably
require some trickery within Vim to maintain a /proc/PID/cwd-esque tree of
Vim processes and their :cd values)

But for now I would be happy for the cwd of the bash instance in the
current window. My problem is I don't know how to get the PID of the
current window (indeed if someone can suggest a better approach I'm all
ears!)

Thanks


On 7 September 2014 08:43, Riccardo Sven Risuleo <[email protected]>
wrote:

> Hi Paul,
> I have been struggling with the same issue (I think): I am working in some
> directory with vim, I open a new terminal to do some manipulations on the
> files, and bam! I'm in ~ and have to navigate back to where I was...
> utterly annoying!
>
> I have found a solution in oh-my-zsh (I am using zsh). I have written a
> small plugin that will save the dirstack to a file, and all instances of
> zsh will read the file and start from pwd.
> Every cd action updates the dirstack.
>
> There is even a convenient "jump" instruction that prints the dirstack and
> allows you to switch to a specific folder via shortcuts.
>
> You find oh-my-zsh here:
> https://github.com/robbyrussell/oh-my-zsh
>
> and my plugin:
> https://gist.github.com/rsrsl/b14eaf568a240f9d0486
>
> Git clone to oh-my-zsh/custom/plugins/ as tilingaware, and put tilingaware
> as plugin in your zshrc.
>
> Otherwise you can for sure modify the thing to work on any shell!
>
> Enjoy, and let me know if you need help installing it :)
> Den 7 sep 2014 09:24 skrev "Paul Jolly" <[email protected]>:
>
> Hi - this will I'm sure be a fairly basic question.
>>
>> I have a keyboard shortcut to launch a urxvt:
>>
>> terminal = "urxvt"
>> -- ...
>> awful.key({ modkey,           }, "Return", function ()
>> awful.util.spawn(terminal) end)
>>
>> What I'm now looking to do is setup another key binding that, given the
>> currently active window, a urxvt instance, launches another instance which
>> uses the same CWD.
>>
>> Has anyone done this before?
>>
>> If I can can the PID of the current window that will be enough to then
>> use pwdx or similar approaches.
>>
>> Other thoughts/approaches?
>>
>> Thanks,
>>
>>
>> Paul
>>
>

Reply via email to