Created
March 7, 2012 06:34
-
-
Save anekos/1991480 to your computer and use it in GitHub Desktop.
zsh の履歴ファイルから、autojump のカウントファイル(?)に追加する (ruby1.9)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
うさげ
$ 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
時間かかるよ!
zsh の履歴で重複を許してない人があまり意味ないかも
~/.local/share/autojump/autojump.txt に反映されるようです