How to automatically source ~/.profile after editing it in fish shell

From razwiki
Jump to navigation Jump to search
function postexec_source_profile --on-event fish_postexec
    if test (echo "$argv" | string trim) = "$EDITOR ~/.profile"
        echo -n 'Sourcing .profile... '
        source ~/.profile
        echo done.
    end
end

https://github.com/razzius/fish-functions/blob/master/config.fish#L30