How to automatically source ~/.profile after editing it in fish shell: Difference between revisions

From razwiki
Jump to navigation Jump to search
(Created page with "<pre> function postexec_source_profile --on-event fish_postexec if test (echo "$argv" | string trim) = "$EDITOR ~/.profile" echo -n 'Sourcing .profile... '...")
 
No edit summary
 
Line 6: Line 6:
echo done.
echo done.
end
end
end
</pre>
</pre>



Latest revision as of 12:24, 6 December 2021

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