Last active
September 22, 2024 22:08
-
-
Save halicki/58cedaf90f3e85277a799cef8217fc72 to your computer and use it in GitHub Desktop.
Midnight commander wrapper script for the fish shell
This file contains 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
function mc | |
set SHELL_PID %self | |
set MC_PWD_FILE "/tmp/mc-$USER/mc.pwd.$SHELL_PID" | |
/usr/bin/mc -P $MC_PWD_FILE $argv | |
if test -r $MC_PWD_FILE | |
set MC_PWD (cat $MC_PWD_FILE) | |
if test -n "$MC_PWD" | |
and test -d "$MC_PWD" | |
cd (cat $MC_PWD_FILE) | |
end | |
rm $MC_PWD_FILE | |
end | |
end |
if not test -d "/tmp/mc-$USER"
mkdir -p "/tmp/mc-$USER"
end
Check for directory first
SHELL=/bin/fish /usr/bin/mc -P $MC_PWD_FILE $argv
for set fish as default on C-o
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!