Created
December 26, 2024 11:07
-
-
Save azlan/00a0f729eaa09d67bc7677b6818ef498 to your computer and use it in GitHub Desktop.
How to make Midnight Commander exit to its current directory - Fish Shell
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
# copy to ~/.config/fish/functions/ | |
function mc | |
if not test -d "/tmp/mc-$USER" | |
mkdir -p "/tmp/mc-$USER" | |
end | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment