diff --git a/README-ja_JP.md b/README-ja_JP.md index 43b46053..39d05088 100644 --- a/README-ja_JP.md +++ b/README-ja_JP.md @@ -543,7 +543,7 @@ $ ble-color-show ble-bind -f 'C-x h' 'insert-string "Hello, world!"' ``` -C-x 等のキー表記については +上記の C-x h の様なキー表記については [マニュアル §3.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs) で詳細に説明されています。 スペース・タブ・エンター・バックスペース・エスケープなどの特殊キーの表記については [マニュアル §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs-ret) で説明されています: @@ -552,7 +552,7 @@ ble-bind -f 'C-x h' 'insert-string "Hello, world!"' エンター・リターンキーは端末によって C-m または RET と表現します。 バックスペースは端末によって C-?, DEL, C-h, または BS 等様々な表現があります。 Ctrl+ReturnShift+Return などの修飾された特殊キーの取り扱いについては -[マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#sec-modifyOtherKeys-manual) で説明されています。 +[マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-modifyOtherKeys-manual) で説明されています。 お使いの端末が `modifyOtherKeys` に対応していない場合、手動で各キーの組み合わせに対応するエスケープシーケンスを設定する必要があります。 @@ -599,6 +599,17 @@ ble-bind -f C-t my/example1 `fzf` を `ble.sh` と一緒にお使いいただく場合には、[`contrib/fzf` 統合機能](https://github.com/akinomyoga/blesh-contrib#pencil-fzf-integration) を用いて `fzf` を設定していただく必要があります。 詳細についてはリンク先の説明を御覧ください。 +```bash +# blerc + +# 注意: fzf を bash_completion と組み合わせて使用する場合は、fzf-completion よ +# りも先に bash_completion をロードしておく必要があります。 +source /etc/profile.d/bash_completion.sh + +ble-import -d contrib/fzf-completion +ble-import -d contrib/fzf-key-bindings +``` + # 3 ヒント ## 3.1 複数行モード @@ -622,7 +633,7 @@ Bash 4.0 以降では自動補完が有効になり、予測候補が表示さ 候補を確定するには S-RET を入力します (編集文字列の末尾にいる時は right, C-f または end でも確定できます)。 表示されている候補の初めの単語だけ部分的に確定する時は M-f または M-right を入力します。 現在の候補で確定しそのままコマンドを実行する場合には C-RET (※お使いの端末が対応している時) を入力します。 -お使いの端末が対応していない時は [マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual) を参照して下さい。 +お使いの端末が対応していない時は [マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual) を参照して下さい。 ## 3.4 静的略語展開 diff --git a/README.md b/README.md index 2e9f115a..49ec27a7 100644 --- a/README.md +++ b/README.md @@ -516,24 +516,26 @@ For example, with the following setting, "Hello, world!" will be inserted on typ ble-bind -f 'C-x h' 'insert-string "Hello, world!"' ``` -The details on the key representation like C-x is described in [Manual §3.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs). -The representations of space/tab/enter/backspace/escape, etc. are described in [Manual §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs-ret): +The details on the key representation, such as C-x h in the above example, +are described in [Manual §3.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs). +The representations of Space, Tab, Enter, Backspace, Escape, etc. are described +in [Manual §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs-ret): The space is represented as SP, the tab key is represented as C-i or TAB depending on the terminal, the enter/return key is represented as C-m or RET depending on the terminal, and the backspace key is represented as C-?, DEL, C-h, or BS depending on the terminal. The representations of modified special keys such as Ctrl+Return and Shift+Return are described -in [Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual): +in [Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual): If your terminal does not support `modifyOtherKeys`, you need to manually configure the escape sequences of modified special keys. -For another example, if you want to invoke a command on typing M-c, you can write as follows: +For another example, if you want to invoke a command on typing M-c, you can write it as follows: ```bash ble-bind -c 'M-c' 'my-command' ``` -Or, if you want to invoke a edit function (designed for Bash `bind -x`) on typing C-r, you can write as follows: +Or, if you want to invoke a edit function (designed for Bash `bind -x`) on typing C-r, you can write it as follows: ```bash ble-bind -x 'C-r' 'my-edit-function' @@ -568,7 +570,18 @@ ble-bind -f C-t my/example1 ## 2.8 fzf integration If you would like to use `fzf` in combination with `ble.sh`, you need to configure `fzf` using [the `contrib/fzf` integration](https://github.com/akinomyoga/blesh-contrib#pencil-fzf-integration). -Please follow the instructions in the link. +Please follow the instructions in the link for the detailed description. + +```bash +# blerc + +# Note: If you want to combine fzf-completion with bash_completion, you need to +# load bash_completion earilier than fzf-completion. +source /etc/profile.d/bash_completion.sh + +ble-import -d contrib/fzf-completion +ble-import -d contrib/fzf-key-bindings +``` # 3 Tips @@ -596,7 +609,7 @@ The suggested contents can be inserted by typing S-RET If you want to insert only first word of the suggested contents, you can use M-right or M-f. If you want to accept the suggestion and immediately run the command, you can use C-RET (if your terminal does not support special key combinations like C-RET, please check -[Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual)). +[Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual)). ## 3.4 Use `sabbrev` (static abbrev expansions) diff --git a/contrib b/contrib index 5b627d22..4fc0bf65 160000 --- a/contrib +++ b/contrib @@ -1 +1 @@ -Subproject commit 5b627d227109b9c278797a97d5beaaedc1e0d7ab +Subproject commit 4fc0bf65458c45c5619902160d30ee3631fdf6bb diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 0cacf3f1..a982a07d 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -330,6 +330,7 @@ - main: fix adjustments of bash options (reported by rashil2000) `#D1895` 138c476 - complete: suppress error messages for non-bash_completion `_parse_help` (reported by nik312123) `#D1900` 267de7f - prompt: fix the marker position for the readline variable `show-mode-in-prompt` (reported by Strykar) `#D1903` 09bb4d3 +- highlight: fix a bug that `bleopt filename_ls_colors` is not working (reported by qoreQyaS) `#D1919` xxxxxxx ## Documentation @@ -342,6 +343,7 @@ - wiki/Q&A: add item for defining a widget calling multiple widgets (motivated by micimize) `#D1898` e19b796 - blerc: rename from `blerc` to `blerc.template` `#D1899` e19b796 - README: add a link to the explanation on the "more reliable setup" of bashrc (motivated by telometto) `#D1905` 09bb4d3 +- README: describe `contrib/fzf` integration (reported by SuperSandro2000, tbagrel1) `#D1907` 3bc3bea xxxxxxx - README: add links to Manual pages for *kspec* and `modifyOtherKeys` `#D1917` xxxxxxx ## Optimization diff --git a/lib/core-syntax.sh b/lib/core-syntax.sh index 83c8181d..b01be636 100644 --- a/lib/core-syntax.sh +++ b/lib/core-syntax.sh @@ -6438,8 +6438,12 @@ function ble/syntax/highlight/ls_colors/.parse { done } -## @fn ble/syntax/highlight/ls_colors -## @var[in,out] type +## @fn ble/syntax/highlight/ls_colors filename +## 対応する LS_COLORS 設定が見つかった時に g を上書きし成功します。 +## それ以外の場合は g は変更せず失敗します。 +## @param[in] filename +## @var[in] type +## @var[in,out] g function ble/syntax/highlight/ls_colors { local file=$1 if ((type==ATTR_FILE_FILE)); then @@ -6448,15 +6452,18 @@ function ble/syntax/highlight/ls_colors { ext=${ext#*.} [[ $ext ]] || break if ble/syntax/highlight/ls_colors/.read-extension "$ext"; then - type=g:$ret + local g1=$ret + ble/color/face2g filename_ls_colors; g=$ret + ble/color/g#append g "$g1" return 0 fi done fi - local g=${_ble_syntax_highlight_lscolors[type]} - if [[ $g ]]; then - type=g:$g + local g1=${_ble_syntax_highlight_lscolors[type]} + if [[ $g1 ]]; then + ble/color/face2g filename_ls_colors; g=$ret + ble/color/g#append g "$g1" return 0 fi @@ -6467,9 +6474,7 @@ function ble/syntax/highlight/getg-from-filename { local filename=$1 type= ble/syntax/highlight/filetype "$filename" if [[ $bleopt_filename_ls_colors ]]; then - if ble/syntax/highlight/ls_colors "$filename" && [[ $type == g:* ]]; then - local ret; ble/color/face2g filename_ls_colors; g=$ret - ((g|=${type:2})) + if ble/syntax/highlight/ls_colors "$filename"; then return 0 fi fi @@ -6758,8 +6763,10 @@ function ble/progcolor/highlight-filename/.pathspec.wattr { if ble/syntax/util/is-directory "$epath"; then local type - ble/syntax/highlight/filetype "$epath" && - ble/syntax/attr2g "$type" + if ble/syntax/highlight/filetype "$epath"; then + ble/syntax/highlight/ls_colors || + ble/syntax/attr2g "$type" + fi elif ((wtype==CTX_CMDI)); then # コマンド名の時はディレクトリが存在する必要 #D1419 ble/syntax/attr2g "$ATTR_ERR" @@ -6839,10 +6846,7 @@ function ble/progcolor/highlight-filename/.pathspec-by-name.wattr { local g= if [[ $bleopt_filename_ls_colors ]]; then - if ble/syntax/highlight/ls_colors "$value" && [[ $type == g:* ]]; then - local ret; ble/color/face2g filename_ls_colors; g=$ret - type=g:$((${type:2}|g)) - fi + ble/syntax/highlight/ls_colors "$value" fi [[ $type && ! $g ]] && ble/syntax/attr2g "$type" diff --git a/note.txt b/note.txt index 30f48df1..ff94cc6e 100644 --- a/note.txt +++ b/note.txt @@ -6664,6 +6664,24 @@ bash_tips Done (実装ログ) ------------------------------------------------------------------------------- +2022-12-13 + + * highlight: パス名着色において ls_colors が動いていなかった (reported by qoreQyaS) [#D1919] + https://github.com/akinomyoga/ble.sh/issues/263 + + どうも type=g:* の形で指定した後にそれを外側で g に反映させる事になっている + のが反映させていなかったのが問題であった。いつ壊れたのか確認した。3f1f472d + #D1095 で type == g:* の時の特別の処理が削除されている。実に3年半も動かない + 状態で放置されていた事になる。 + + ディレクトリ名に関しては単純に今まで対応していなかった。 + + ble/syntax/highlight/ls_colors の値の返し方自体を変更する事にした。この関数 + は今迄二箇所でしか呼び出していなくて、両方で呼び出し側で同様に色の合成など + を行っていたので、その色の合成も ble/syntax/highlight/ls_colors に統合する + 事にした。そして直接に g に書き込む様に振る舞いを変更した。その上で / の前 + のディレクトリ名の ls_colors による着色にも対応した。動いている。 + 2022-12-11 * colorglass: オプションで指定した時に256色(またはより少ない色に)に減色する機能? [#D1918] @@ -6846,8 +6864,9 @@ bash_tips 2022-12-05 - * README: fzf-integration について記述する (motivated by SuperSandro2000) [#D1907] + * README: fzf-integration について記述する (motivated by SuperSandro2000, tbagrel1) [#D1907] https://github.com/akinomyoga/ble.sh/issues/259 + https://github.com/akinomyoga/ble.sh/issues/261#issuecomment-1346450426 * display-shell-version にも integration が入っていない時にメッセージを表示 する様にする。fzf についてはメッセージを出力した。 @@ -6882,6 +6901,9 @@ bash_tips https://github.com/ajeetdsouza/zoxide/commit/d106f4e3580d5594d8f1c96c256a8f085e2781a4 + 2022-12-13 更に bash_completion を先にロードしておくべきという事についても + 記述した。 + * colorglass: saturation (彩度) についての設定を追加する (motivated by auwsom) [#D1906] https://github.com/akinomyoga/ble.sh/issues/258