To make this work you need to export RECENTLY_EDITED_FILES_LOG to some suitable log file path (in your bashrc/zshrc file), name the script above vim, make it executable, and then place it onto your system’s PATH. After these steps are complete, any files that you open in vim will be logged to this file.

If you use another editor besides vim, you can still use this script. You just have to make sure the name of the script matches the name of your editor. There is no need to make any changes to the script above.

What can you use this for?

There are two applications that I have thought of so far, though I’m sure there are many more.