function Start-Ranger {
[CmdletBinding()]
param (
[Parameter()]
[string]
$Path = $pwd.Path
)
try {
$Path = [System.IO.Path]::GetFullPath($Path).TrimEnd('\')
$wslCommand = 'ranger --choosedir=$HOME/.rangerdir $(wslpath "{0}")' -f $Path
wsl -- eval $wslCommand
}
finally {
# Navigate the local PowerShell session to the last folder that was opened in ranger.
$lastDir = wsl -- eval 'wslpath -w $(cat $HOME/.rangerdir)'
Set-Location $lastDir
}
}
Last active
December 14, 2020 09:40
-
-
Save manualbashing/e521490eddd8e05306bbc7a17a6c16d3 to your computer and use it in GitHub Desktop.
Use ranger running in wsl from Windows PowerShell session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
published: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment