broot: Alt-Enter does not work on Windows

alt-enter is the Windows Console / Terminal shortcut to maximize/restore the console/terminal window. Therefore, it is not possible to execute :open_leave or :cd with this shortcut. Changing the shortcut works for :open_leave only. When trying to set

{
  key: shift-enter
  execution: ":cd"
}

you get Bad configuration: not a known internal: cd

this stand in the way of a br function in powershell, where you can change dir with a shortcut:

function br() {
	$tmp = [System.IO.Path]::GetTempFileName()
	c:\OwnApp\Tools\broot.exe --outcmd "$tmp" $args
	$cd = Get-Content "$tmp"
	Remove-Item -Force "$tmp"
	$dir = $cd.substring(3)
	if (Test-Path -PathType Container "$dir") {
		if ("$dir" -ne "$pwd") {
			Push-Location "$dir"
		}
	}
}

(selecting the path and then :cd is working, but a shortcut would be nice)

This problem occurs with broot running locally on Windows, but also with broot running on a remote host, when connected over ssh in the Windows Console / Terminal

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Also, for those of us using git-bash on Windows.

Would it be possible to fix/escape the path that’s being returned when invoking :cd ?

br_cd_error

So hitting enter does not result in an error message, like: bash: cd: C:Windowssystem32: No such file or directory

@Canop it’s what this issue was opened with (regardless of the shortcut key):

{
  key: shift-enter
  execution: ":cd"
}

results in

Bad configuration: not a known internal: cd

edit: found this related issue and added a comment there: https://github.com/Canop/broot/issues/365

Thanks much to both of you!

@AeliusSaionji Your code fixed the slashes issue just fine. But it also generated:

br_cd_error_2

& the error: bash: cd: cd C:/Windows/system32: No such file or directory


@Canop That would be great if you do the replacement in Broot itself.

Also, could the source statement that broot --install writes to .bashrc and .bash_profile be modified to use forward slashes?

i.e.: source C:/Users/Windows/AppData/Roaming/dystroy/broot/data/launcher/bash/1