Tmux改行インジケータ

Tmux改行インジケータ

私のtmux端子が出力ラインを動的にラップする位置を一目で見たいです。現在のラッパーラインは次のとおりです。

This is a very long sentence that did not
fit on one screen line.

代わりに、次のように見せたいです。

This is a very long sentence that did not
>>> fit on one screen line.

この効果を得るために、以下でvimこれを使用します。set breakindentopt sbr=>>>tmuxにも同様のオプションがありますか?

ベストアンサー1

これが可能かどうかはわかりませんが、解決策にも興味があります。次のbashスクリプトを使用して同様の動作をシミュレートできますが、まったくテストされておらず、簡単なユースケースではすでに中断される可能性があります。

#!/usr/bin/env bash

cols=$(tput cols)
colsi=$((${cols} + 1))
wrap='>>> '

$@ | while IFS='' read -r line; do
    while [ ${#line} -gt ${#wrap} ]; do
        echo "${line}" | cut -c-"${cols}"
        line="${wrap}"$(echo "${line}" | cut -c"${colsi}"-)
    done
done

このスクリプトが行うことは、引数()を繰り返して$@出力行を印刷し、$wrap次の出力行に変数を追加することです。これは独立しており、tmux内部または外部で使用できます。スクリプトをegというファイルに保存wrapperし、次のように呼び出します。

$ x='This is just a very long silly line, it should show the use case of the wrapper script, that means the only thing this silly text is supposed to do, is to be long enough to be wrapped. Since I dont know what resolution you have on your screen, you might want to extend this line yourself to make sure it is wrapped.'

$ echo "$x"
> This is just a very long silly line, it should show the use case of the wrapper script, that means the only thing this silly text is supposed to do, is to be long enough to be wrapped. Since
> I dont know what resolution you have on your screen, you might want to extend this line yourself to make sure it is wrapped.

$ wrapper echo "$x"
> This is just a very long silly line, it should show the use case of the wrapper script, that means the only thing this silly text is supposed to do, is to be long enough to be wrapped. Since
> >>> I dont know what resolution you have on your screen, you might want to extend this line yourself to make sure it is wrapped.

echo "$x"との間の出力の違いに注意してくださいwrapper echo "$x"

おすすめ記事