fish/functions/_sponge_on_preexec.fish 604 B raw
1
function _sponge_on_preexec --on-event fish_preexec \
2
  --argument-names command
3
  _sponge_clear_state
4
5
  set --global _sponge_current_command $command
6
7
  builtin history search --case-sensitive --exact --max=1 --null $command \
8
    | read --local --null found_entries
9
10
  # If a command is in the history and in the queue, ignore it, like if it wasn’t in the history
11
  if test (count $found_entries) -ne 0; and not contains $command $_sponge_queue
12
    set --global _sponge_current_command_previously_in_history true
13
  else
14
    set --global _sponge_current_command_previously_in_history false
15
  end
16
end