Skip to content

Commit

Permalink
add on-prompt docs to README
Browse files Browse the repository at this point in the history
  • Loading branch information
cxreg committed Apr 11, 2012
1 parent ad855a6 commit c9d4b90
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,40 @@ WHAT ELSE CAN IT DO?
The other template editor actions are "show", "list", and "delete".


NESTABLE PROMPT COMMANDS

Users can define their own actions which will be taken just before each
prompt is displayed. In fact, smartcd itself can use this mechanism to
invoke itself.

smartcd on-prompt takes this concept to a new level. By specifying commands
to be run, they will be run on each prompt, similar to the built-in feature,
but only while you are in the current directory and its children. In
addition to this, further on-prompt commands specified in child directories
will run in addition to the current ones rather than replacing them.

For example:

~/foo$ smartcd on-prompt 'echo test 1'
test 1
~/foo$ cd bar
test 1
~/foo/bar$ smartcd on-prompt 'echo test 2'
test 1
test 2
~/foo/bar$ cd ..
test 1
~/foo$ cd
~$

One way that someone might use this is in concert with the history helper,
to flush and optionally reload their history on each prompt, to facilitate
cross-terminal sharing.

smartcd helper run history localize __PATH__/.history
smartcd on-prompt 'history -a; history -n'


EXIT HOOK

By default, your enter scripts will be run when a shell is started. However,
Expand Down

0 comments on commit c9d4b90

Please sign in to comment.