Skip to content

Instantly share code, notes, and snippets.

@curipha
Last active June 19, 2022 12:46
Show Gist options
  • Save curipha/fa243aa3f1550d27cd89cc029aa30bfd to your computer and use it in GitHub Desktop.
Save curipha/fa243aa3f1550d27cd89cc029aa30bfd to your computer and use it in GitHub Desktop.
History merge tool for zsh
#!/usr/bin/env ruby -E BINARY
# The original script was published in zsh thread@2ch.net and is licensed under the public domain.
history = []
l = nil
while l = gets
while /\\\Z/ === l
l << gets
end
history << l
end
puts history.sort
#puts history.sort.uniq
# 'uniq' is not work well because history = [': 1332408755:0;ls', ': 1332408761:0;ps', ...]
# You shoud leave unifying history to zsh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment