LoginSignup
1
0

More than 1 year has passed since last update.

Mac | peco でシェルのコマンド履歴からクリップボードにコピーする

Last updated at Posted at 2017-10-05

コマンド例

$ history 1 | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\*?\s*//; $in=$_; if (!(grep {$in eq $_} @lines)) { push(@lines, $in); print $in; }' | peco | tr -d '\n' | pbcopy

履歴からコピーして

image.png

他のエディタなどにペーストできる。

image.png

エイリアス登録

.bash_profile などに。

alias pp="history 1 | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\*?\s*//; \$in=\$_; if (!(grep {\$in eq \$_} @lines)) { push(@lines, \$in); print \$in; }' | peco | tr -d '\n' | pbcopy"

環境

  • peco version v0.5.1
  • Mac OSX Sierra

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0