Skip to content

Instantly share code, notes, and snippets.

@halicki
Last active September 22, 2024 22:08
Show Gist options
  • Save halicki/58cedaf90f3e85277a799cef8217fc72 to your computer and use it in GitHub Desktop.
Save halicki/58cedaf90f3e85277a799cef8217fc72 to your computer and use it in GitHub Desktop.
Midnight commander wrapper script for the fish shell
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
@OMedicks
Copy link

Thank you!

@azlan
Copy link

azlan commented Jul 27, 2022

    if not test -d "/tmp/mc-$USER"
        mkdir -p "/tmp/mc-$USER"
    end

Check for directory first

@Chu-4hun
Copy link

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