Axel Liljencrantz wrote: > Silly me. An event handler is a command substitution, so that will always > evaulate to true. > > Ok, new approach. Lets' define a cd function. The trouble here is that a > cd wrapper function is already defined, doing things with the directory > history. So we redefine it as __cd_wrapper. Something like this: > > eval (functions cd|sed -e 's/function cd/function __cd_wrapper/')\n > function cd > __cd_wrapper $argv > if status --is-command-substitution > return > end > blah blah blah > end
This works. > A bit of a hack, but it could be worse. There should be a simpler way to insert hooks, without knowing the global state. The effect of a change, especially by the end-user, should be localised, not heavily dependent on knowledge of the entire system, and in turn, the user level change should not alter the global defns. > >>>> Zsh has a function called chpwd() that gets called whenever the working >>>> directory gets changed (from the user's point of view). Can something >>>> similar be defined for fish? >>>> The Zsh solution is simpler and robust, I think. I hope comparisons with other shells are welcomed here. Fish has a nice set of features, but it will have to put in a little extra thought to become robust and intuitive. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
