Skip to content

Instantly share code, notes, and snippets.

@anekos
Created March 7, 2012 06:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/1991480 to your computer and use it in GitHub Desktop.
Save anekos/1991480 to your computer and use it in GitHub Desktop.
zsh の履歴ファイルから、autojump のカウントファイル(?)に追加する (ruby1.9)
#!/usr/bin/ruby
# vim:set fileencoding=utf-8 :
require 'shellwords'
ARGF.each do
|line|
line.chomp!
line.sub!(/\A.+?;/, '') rescue next
next unless m = line.match(/\Acd\s+(~?\/.*)/)
path = m[1].sub(/\A~/, ENV['HOME']).gsub(/\/+/, '/')
`autojump -a #{Shellwords.shellescape(path)}`
end
@anekos
Copy link
Author

anekos commented Mar 7, 2012

時間かかるよ!
zsh の履歴で重複を許してない人があまり意味ないかも

~/.local/share/autojump/autojump.txt に反映されるようです

@anekos
Copy link
Author

anekos commented Mar 7, 2012

うさげ

$ ruby zsh-history-to-autojump.rb $HISTFILE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment