PowerShell_Scripts/base.linux/sranger.ps1

21 lines
882 B
PowerShell
Raw Normal View History

2021-11-29 22:00:43 +00:00
[CmdletBinding()]param(
[Parameter(Position = 0, ValueFromRemainingArguments)]
[string[]]$Path,
[string]$User,
[switch]$NoTmuxManipulations
)
$local:sudoParams = @{sudoArgs=@("-i")}
if( $User ) {
$sudoParams.sudoArgs += @("-u",$User)
}
if( -not $NoTmuxManipulations ) {
# this should probably be controlled by byobu-keybindings script, but it looks like it's broken
tmux source-file $env:BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable ';' source-file ~/.byobu/keybindings.tmux ';' display-message "Byobu F-keys: DISABLED"
}
Invoke-ExpressionEx -sudo @sudoParams "`$env:TERM='tmux-256color'; `$env:EDITOR='$env:EDITOR'; ranger $($Path -join '')"
if( -not $NoTmuxManipulations ) {
tmux source-file $env:BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux ';' source-file ~/.byobu/keybindings.tmux ';' display-message "Byobu F-keys: ENABLED"
}