Help us understand the problem. What is going on with this article?

Zsh の history を fish で使えるものに変換する

More than 3 years have passed since last update.

Zsh => fish に移行するときに Zsh の history も移行したいときに変換したメモ。

fish の history ファイルは ~/.local/share/fish/fish_history にあるが、中を見ると基本的にコマンドとタイムスタンプを記録した YAML だったので Ruby のワンライナーで簡単に変換できた (パスの情報とかも含まれるようだったが無視した) 。

$ fc -lni 1 | ruby -rtime -r yaml -e 'puts STDIN.inject([]) { |a, l| a << { "cmd" => l[16..-1].strip, "when" => Time.parse(l[0..15]).to_i } }.to_yaml(options = { line_width: -1 })' > history-from-zsh.yml

これを Zsh で実行してできたファイルを ~/.local/share/fish/fish_history にコピー (もしくは合体) させればいい。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした