From 612355143355311b47ce1b570f9fa1fbcd7b45d4 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sat, 11 Dec 2021 13:12:38 +0900 Subject: [PATCH] README: describe how to invoke multiple widgets with a keybinding --- README-ja_JP.md | 16 ++++++++++++++++ README.md | 16 ++++++++++++++++ docs/ChangeLog.md | 1 + note.txt | 8 +++++--- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/README-ja_JP.md b/README-ja_JP.md index 174d22da..305585c2 100644 --- a/README-ja_JP.md +++ b/README-ja_JP.md @@ -483,6 +483,22 @@ $ ble-bind -P $ ble-bind -L ``` +一つのキーで複数の編集関数を呼び出したい場合は、以下の例の様に、 +`ble/widget/編集関数の名前` という名前のシェル関数を通して新しい編集関数を定義できます。 +既存の標準の編集関数と名前が重複しない様に、 +編集関数の名前は `ユーザー名/`, `my/`, `blerc/`, `dotfiles/` などで始める事が強く推奨されます。 + +```bash +# C-t で複数の操作を行う例 +function ble/widget/my/example1 { + ble/widget/beginning-of-logical-line + ble/widget/insert-string 'echo $(' + ble/widget/end-of-logical-line + ble/widget/insert-string ')' +} +ble-bind -f C-t my/example1 +``` + # 3 ヒント ## 3.1 複数行モード diff --git a/README.md b/README.md index db72dd48..01e5d563 100644 --- a/README.md +++ b/README.md @@ -453,6 +453,22 @@ The list of widgets is shown by the following command: $ ble-bind -L ``` +If you want to run multiple widgets with a key, you can define your own widget by creating a function of the name `ble/widget/YOUR_WIDGET_NAME` +as illustrated in the following example. +It is highly recommended to prefix the widget name with `YOUR_NAME/`, `my/`, `blerc/`, `dotfiles/`, etc. +in order not to conflict with the names of the existing standard widgets. + +```bash +# Example of calling multiple widgets with the key C-t +function ble/widget/my/example1 { + ble/widget/beginning-of-logical-line + ble/widget/insert-string 'echo $(' + ble/widget/end-of-logical-line + ble/widget/insert-string ')' +} +ble-bind -f C-t my/example1 +``` + # 3 Tips ## 3.1 Use multiline mode diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index a53c1e0e..53c712e3 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -200,6 +200,7 @@ - blerc: add all the missing options `#D1667` 0228d76 - blerc: add missing faces `argument_option` and `cmdinfo_cd_cdpath` (reported by Prikalel) `#D1675` 26aaf87 +- README: describe how to invoke multiple widgets with a keybinding (motivated by michaelmob) `#D1699` 0000000 ## Optimization diff --git a/note.txt b/note.txt index 2ae8cdff..020dabee 100644 --- a/note.txt +++ b/note.txt @@ -1621,9 +1621,6 @@ bash_tips * PROMPT_COMMAND / trap DEBUG で問題が起こる? (found by rashad-moves) https://github.com/rashad-moves/HomeConfigurationFiles/commit/efbac4153fd5021f1bc00d42c618fd9d6f4090b9 - * 一つのキーで複数の widget を呼び出す方法? - https://github.com/michaelmob/portable-config/commit/49f9566afd8b62d47a090328104ad803962e6d3f - 2021-12-06 * complete: 沢山 quote が発生する場合には '' で囲むべきなのではないか。 @@ -5633,6 +5630,11 @@ bash_tips 2021-12-11 + * README: 一つのキーで複数の widget を呼び出す方法? (motivated by michaelmob) [#D1699] + https://github.com/michaelmob/portable-config/commit/49f9566afd8b62d47a090328104ad803962e6d3f + + 説明を書いた。設定例の動作確認もした。 + * bind: "" で囲まれていない keyseq \C-l を解釈できない (motivated by cmplstofB) [#D1698] https://github.com/cmplstofB/dotfiles/blob/master/_dffiles/.config/bash/bashrc#L170-L172