Last active
August 29, 2015 14:08
-
-
Save drewthorp/d8e5d888be72244b8d8a to your computer and use it in GitHub Desktop.
A fish shell function that emits an event when the current directory changes. As of version 2.1.1, function that capture events do not seem to work as autoloading functions, so the easiest thing is to place this in config.fish. As this uses the fish_prompt event, the change of directory will only be notes when a prompt is displayed. It would be …
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
| set -xg FS_CURRENT_DIR "" | |
| function fs_change_directory -e fish_prompt | |
| set -l this_dir (PWD) | |
| if [ $this_dir != $FS_CURRENT_DIR ] | |
| set -xg FS_CURRENT_DIR (pwd) | |
| emit directory_changed | |
| end | |
| end |
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
| function fs_change_directory --on-variable PWD | |
| emit directory_changed | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment