window: Implement commands auto substitution from the history