My history file looks like:
I am working on a widget for fuzzy search history.
output=$(history -1 1 | sd '^[ ]*[0-9]*[ ]*' '' | sk --tac --no-sort --exact)
if [ $? -eq 0 ]; then
zle -N skim-history
bindkey '^R' skim-history
In `history -1 1 | sd '^[ ]*[0-9]*[ ]*' '' | sk --tac --no-sort --exact`, sd is used instead of sed, which just removes numbers from the beginning. However, it messes things up if the command is multi-line.
What I found is, the only way zsh history parsing works correctly is if I use something like !NUM, to get the history. How can I edit my zle extension to do that?
Another option is (if previous fails), do not save multi line commands in history. How can I do that?