Depends on the lua you're using. You'd have to
bind f9 to do something like //gs c toggle_pdt or whatever the command you need. You'd bind it at the top of the file, and then add a function called file_unload() at the bottom and
unbind the key again. There may already be a file_unload() function, in which case you'd just put the unbind command in the existing one.