Open x4lldux opened 5 years ago
I don't fully understand the use for this feature, if I want to time something usually I would just write a time function.
Borrowed the idea from ZSH. It's usually used to enhance prompt and timing is just an example (though I'm often wandering how long does something takes only after starting it ;) ). This is needed for another PR which allows cd -
go to previous directory.
I understand - I am still unsure, I will need to think about it and read the zsh documentation.
It seems to me this patch breaks multi line input.
Should be easy to fix. Basically need to do the same thing you do in want-implicit-parens
and detect that. I'll test it in few days.
Right, I am leaning towards allowing the repl changes to hide the exit codes, in which case that fix may be able to go there.
There is a kind of hook commonly found in shells which is executed right before showing the prompt (and sometimes also after showing it).
This is used by direnv integrations, which I must currently call in my prompt function.
For reference:
precmd_functions
http://zsh.sourceforge.net/Doc/Release/Functions.html#index-functions_002c-hook$PROMPT_COMMAND
https://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html--on-event fish_prompt
https://fishshell.com/docs/current/commands.html#fish_prompt@pauldub You're right, equivalent of $PROMPT_COMMAND
/precmd_function
should be added. Calling direnv in *prompt*
is kind a hackish and entangles concerns.
I like direnv, so that is a good argument for me.
Once changes to repl in #161 are done, I will update this & add precmd hook also.
I would prefer on-crash be renamed to on-error or something else, it isn't necessarily a 'crash'. I know one use for this hook is what nixos does, which is to offer a list of packages for a user to install if a binary is missing.
Sure, so *post-crash-hook*
-> *post-error-hook*
?
Fefora has something similar. Use cases for those hooks are many! I saw a precmd
hook function that changes terminal's profile so the background is red when you ssh to a remote server just to be extra alert.
Runs
*pre-exec-hook*
&*post-exec-hook*
functions before/after execution of a line. Can be used to time how long a command took: