Closed WizardUli closed 9 months ago
I tried it: https://github.com/Canop/broot/pull/814 It does work for Alacritty, but I fail to see other use cases right now.
I think Open terminal here use-case is completely common in our universe and even Windows Explorer has it.|
Files manager which keeps their CWD in sync with their currently displayed folder:
kitty - maybe the most popular terminal (with inbuilt multiplexer) - also supports opening a new pane/tab/window in CWD of the process currently controlling terminal via dedicated commands
new_tab_with_cwd
new_tab_with_cwd
new_window_with_cwd
these are not accidental commands since even their names' suffix _with_cwd
is certainly not accidental.
I've been seeing this functionality for many years and came to think it is pretty standard but maybe these terminals&multiplexers and file-managers are pretty niche themself. Having it supported by broot would make opening new tab/pane/window in currently displayed folder in these terminals completely zero configuration.
Alternative is for user to define separate verbs like:
-Sales pitch over-
Hey, I really don't know how common it is. Broot is the first interactive file-manager-like (somewhat) application I encountered which does not sync its CWD. I can happily use your PR (haven't tried it yet btw.) as a patch during every and each broot upgrade. It's almost zero effort for me with Nix(OS)/home-manager.
Is it something which general audience may expect? IDK. Might there by any drawbacks? I don't think so but I really don't know. :(
I'll do it.
Main question is should it be opt-in or opt-out (i.e. can it have a cost or negative side effects ?).
I made it opt out.
@WizardUli Can you try the PR before I merge it ?
This feature is available with the just released 1.31.0
Oh wow, thanks for this! I was curious if it obviated the need for the shell wrapper, and I think it doesn't, but it's very welcome for use within tmux, where opening a new pane/window/split/whatever always uses the broot-current folder.
I already had these related verbs, replacing two tmux binds just in the context of broot:
{
key: f4
shortcut: z
external: tmux splitw
set_working_dir: true
leave_broot: false
}
{
key: ctrl-t
shortcut: tab
external: tmux new-window -c {directory}
set_working_dir: true
leave_broot: false
}
And now I can get rid of them entirely, as using the tmux binds will work the same way.
Hello. I'd like to suggest to keep broot's main process working directory in sync with the directory it is currently displaying just like the famous nnn file browser does (where you can literally just
ls -la /proc/<pid of specific nnn process>/cwd
to get the currently opened directory in that specific nnn instance).This would have immediate benefits at least in:
(Caveat: Zellij seems to be using CWD of the oldest still running process in the currently focused pane so nnn (or broot in the future) must be running in that pane directly without underlying shell like bash or fish (which is quite normal and common anyway in Zellij). Alacritty is more inteligent and uses CWD of the current TTY controlling process.)