過去の端末出力で一部のテキストを閲覧してコピーする方法は?

過去の端末出力で一部のテキストを閲覧してコピーする方法は?

質問

作業中にgit最後のコマンドの出力から何かをコピーする必要があることがよくあります。私はキーボードからトラックパッド/マウスに切り替えるのが嫌いです。

ケース1

...
➜  extract_ttc git:(feature/simplify-gha-workflows) git push
fatal: The current branch feature/simplify-gha-workflows has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin feature/simplify-gha-workflows

実行するには手動でコピーする必要があり、git push --set-upstream origin feature/simplify-gha-workflowsキーボードからマウス/トラックパッドに切り替えました。

ケース#2

...
➜  extract_ttc git:(feature/simplify-gha-workflows) git push --set-upstream origin feature/simplify-gha-workflows
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 1.16 KiB | 1.16 MiB/s, done.
Total 6 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'feature/simplify-gha-workflows' on GitHub by visiting:
remote:      https://github.com/fontist/extract_ttc/pull/new/feature/simplify-gha-workflows
remote:
To github.com:fontist/extract_ttc.git
 * [new branch]      feature/simplify-gha-workflows -> feature/simplify-gha-workflows
Branch 'feature/simplify-gha-workflows' set up to track remote branch 'feature/simplify-gha-workflows' from 'origin'.

https://github.com/fontist/extract_ttc/pull/new/feature/simplify-gha-workflows実行するには再コピーする必要があります。open

質問

  • 前のコマンドの端末出力をナビゲートする方法はありますか(マウス/トラックパッドなし)。
  • OSXでiTermを使用しているように、端末アプリケーションに依存しない方法はありますか?
  • 解決策が私が想像通りに機能しない場合は、キーボードのみを使用して同じことを行うことができる方法は何ですか?

ベストアンサー1

私はキーボードからトラックパッド/マウスに切り替えるのが嫌いです。

私も。

前のコマンドの端末出力をナビゲートする方法はありますか(マウス/トラックパッドなし)。

はい、使用してくださいGNU画面または マルチプレクサ。たとえば、GNU画面でコピーモードに入るにはControl- を押し、j [ターミナルでナビゲートするにはj / k / h / lキーを使用する必要があります。一部のテキストをコピーして別のGNUスクリーンウィンドウに貼り付けるか、〜/.screenrcに次の項目を追加して選択したテキストをXクリップボードにコピーすることもできます(X AFAIKはmacOSでは廃止されました)。

bind b eval writebuf 'exec /bin/sh -c " xsel -i < /tmp/screen-exchange"' 'exec /bin/sh -c "killall xsel"'

OSXでiTermを使用しているように、端末アプリケーションに依存しない方法はありますか?

GNU画面とtmuxは端末エミュレータに依存しません。

解決策が私が想像通りに機能しない場合は、キーボードのみを使用して同じことを行うことができる方法は何ですか?

Dabrev - 拡張述べたように、xtermでは https://unix.stackexchange.com/a/139016/72304。それだけです。正確にあなたは何が欲しいですか? iTermにも同様の機能があるかどうかわかりません。

おすすめ記事