14 Jul 19:38
history-beginning-local function
From: Peter Stephenson <pws <at> csr.com>
Subject: history-beginning-local function
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-07-14 17:42:20 GMT
Expires: This article expires on 2008-07-28
Subject: history-beginning-local function
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-07-14 17:42:20 GMT
Expires: This article expires on 2008-07-28
This function allows you to have a local history file so that, for example, you can pick "make" commands appropriate to a local directory without rendering the history unusable for other operations. It uses the "fc -p" command that Wayne added. The main problem is that you have to create and update the local history file yourself since commands aren't saved to it. This is tricky since it happens in the main shell after zle returns. We'd need a hook function of some sort to be able to do the effect of fc -p around the point the history is saved, unless there's a smarter way of doing it. There are probably more subtle problems. # history-beginning-local # # Mostly a drop-in replacement for history-beginning-search-backward # or -forward, depending on the name. # # Allows a local history file to be searched for certain commands to execute. # The main restriction is that at the moment commands are not saved # to the local history file, which needs to be primed by hand # (for example, by selecting lines from the global history file). # # The style local-history-file should be set to a file that # will contain the local history, in the same format as $HISTFILE, # while local-history-commands should be set to a list of commands # (or patterns matching commands) that should use the local history # file. Both must be set. # # If the style local-history-only is not set the global history(Continue reading)
RSS Feed