README.md (8477B)
1 [ Languages: **English** | [日本語](README-ja.md) (Japanese) ] 2 3 # blesh-contrib 4 Settings for [akinomyoga/ble.sh](https://github.com/akinomyoga/ble.sh) 5 6 Unless otherwise specified, files in this repository is licensed by [BSD 3-clause license](LICENSE). 7 The files in `airline` are licensed by the MIT License. 8 9 ## :pencil: fzf integration 10 11 Source: [`fzf-completion.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-completion.bash), 12 [`fzf-key-bindings.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-key-bindings.bash) 13 14 Note: If you would like to integrate `fzf-completion` with `bash-completion`, `bash-completion` needs to be loaded before `fzf-completion` is loaded. 15 16 ### Option 1: Setup in `~/.fzf.bash` 17 18 If you would like to use fzf with `ble.sh`, for example, you can rewrite your `.fzf.bash` in the following way. 19 In this case, `.fzf.bash` needs to be sourced after `ble.sh`. 20 Please replace `/path/to/fzf-directory`, `/path/to/fzf/...`, and `/path/to/bash_completion.sh` if necessary. 21 22 ```bash 23 # fzf.bash 24 25 # If ble/contrib/integration/fzf cannot find the fzf directory, please set the 26 # following variable "_ble_contrib_fzf_base" manually. The value 27 # "/path/to/fzf-directory" should be replaced by a path to the fzf directory 28 # such as "$HOME/.fzf" or "/usr/share/fzf" that contain 29 # "shell/{completion,key-bindings}.bash" or "{completion,key-bindings}.bash". 30 31 #_ble_contrib_fzf_base=/path/to/fzf-directory 32 33 # Setup fzf 34 # --------- 35 if [[ ! "$PATH" == *"/path/to/fzf/bin"* ]]; then 36 export PATH="${PATH:+${PATH}:}/path/to/fzf/bin" 37 fi 38 39 # Auto-completion 40 # --------------- 41 if [[ $- == *i* ]]; then 42 # Note: If you would like to combine fzf-completion with bash_completion, you 43 # need to load bash_completion earlier than fzf-completion. 44 45 #source /path/to/bash_completion.sh 46 47 if [[ ${BLE_VERSION-} ]]; then 48 ble-import -d integration/fzf-completion 49 else 50 source /path/to/fzf/shell/completion.bash 2> /dev/null 51 fi 52 fi 53 54 # Key bindings 55 # ------------ 56 if [[ ${BLE_VERSION-} ]]; then 57 ble-import -d integration/fzf-key-bindings 58 else 59 source /path/to/fzf/shell/key-bindings.bash 60 fi 61 ``` 62 63 ### Option 2: Setup in `~/.blerc` 64 65 Or, you can directly write settings in your `blerc` as follows. 66 In this case do not source `.fzf.bash` in your `.bashrc`. 67 68 ```bash 69 # blerc 70 71 # If ble/contrib/integration/fzf cannot find the fzf directory, please set the 72 # following variable "_ble_contrib_fzf_base" manually. The value 73 # "/path/to/fzf-directory" should be replaced by a path to the fzf directory 74 # such as "$HOME/.fzf" or "/usr/share/fzf" that contain 75 # "shell/{completion,key-bindings}.bash" or "{completion,key-bindings}.bash". 76 77 #_ble_contrib_fzf_base=/path/to/fzf-directory 78 79 80 # Note: If you would like to combine fzf-completion with bash_completion, you 81 # need to load bash_completion earlier than fzf-completion. 82 83 #source /path/to/bash_completion.sh 84 85 86 # Setup fzf 87 ble-import -d integration/fzf-completion 88 ble-import -d integration/fzf-key-bindings 89 ``` 90 91 ## :pencil: `integration/fzf-git` 92 93 Source: [`fzf-git.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-git.bash) 94 95 You can use the [`junegunn/fzf-git.sh`](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236) settings for `ble.sh` with the following setup. 96 97 ```bash 98 # bashrc / fzf.bash 99 if [[ ${BLE_VERSION-} ]]; then 100 # If needed. See above for details: 101 #_ble_contrib_fzf_base=/path/to/fzf-directory 102 103 _ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio 104 ble-import -d integration/fzf-git 105 fi 106 ``` 107 108 Or you can configure it in `~/.blerc`: 109 110 ```bash 111 # blerc 112 113 # If needed. See above for details: 114 #_ble_contrib_fzf_base=/path/to/fzf-directory 115 116 _ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio 117 ble-import -d integration/fzf-git 118 ``` 119 120 The shell variable `_ble_contrib_fzf_git_config` is a colon-separated list of the enabled types of bindings. 121 The value `key-binding` enables the key bindings of the form <kbd>C-g C-f</kbd>, <kbd>C-g C-b</kbd>, <kbd>C-g C-t</kbd>, <kbd>C-g C-h</kbd>, <kbd>C-g C-r</kbd> and <kbd>C-g C-s</kbd>. 122 The value `sabbrev` enables the sabbrev expansion for the words `gf`, `gb`, `gt`, `gh`, `gr`, and `gs`. 123 The value `arpeggio` enables the simultaneous key combinations of <kbd>g f</kbd>, <kbd>g b</kbd>, <kbd>g t</kbd>, <kbd>g h</kbd>, <kbd>g r</kbd> and <kbd>g s</kbd>. 124 The value `old-functions` enables old function names: `is_in_git_repo`, `fzf-down`, `gh`, `gb`, `gt`, `gh`, `gr`, and `gs`. 125 126 # ⚙ Prompt sequences 127 128 ## :pencil: `contrib/prompt-vim-mode` 129 130 Source: [`prompt-vim-mode.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-vim-mode.bash) 131 132 ### Prompt sequence `\q{contrib/vim-mode}` 133 134 This prompt sequence expands to the vim mode name. 135 136 ```bash 137 # blerc (example) 138 139 ble-import contrib/prompt-vim-mode 140 PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' # show mode name in PS1 141 bleopt keymap_vi_mode_show:= # hide mode line 142 ``` 143 144 ## :pencil: `contrib/prompt-git` 145 146 Source: [`prompt-git.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-git.bash) 147 148 ```bash 149 # blerc (example) 150 151 ble-import contrib/prompt-git 152 bleopt prompt_rps1='\q{contrib/git-info}' 153 ``` 154 155 ### Prompt sequence `\q{contrib/git-info}` 156 157 This expands to a string that explains the current git status. 158 159 ### Prompt sequence `\q{contrib/git-name}` 160 161 This expands to the directory name of the repository. 162 163 ### Prompt sequence `\q{contrib/git-hash N}` 164 165 This expands to the commit hash. 166 The hash is truncated to the length `N`. 167 The default value for `N` is `7`. 168 169 ### Prompt sequence `\q{contrib/git-branch}` 170 171 This expands to the branch name (or tag name or hash) of `HEAD`. 172 173 ### Prompt sequence `\q{contrib/git-path}` 174 175 This expands to the current path relative to the root directory of the repository. 176 177 ## :pencil: `contrib/prompt-elapsed` 178 179 Source: [`prompt-elapsed.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-elapsed.bash) 180 181 Measures the time of the previous command execution. 182 183 ```bash 184 # blerc (example) 185 186 ble-import contrib/prompt-elapsed 187 bleopt prompt_rps1='\g{fg=69,italic}\q{contrib/elapsed}' 188 ``` 189 190 ### Prompt sequence `\q{contrib/elapsed}` 191 192 This expands to the high-resolution elapsed time for the command execution. 193 194 ### Prompt sequence `\q{contrib/elapsed-real}` 195 196 This expands to the `real` time of `time`. 197 198 ### Prompt sequence `\q{contrib/elapsed-user}` 199 200 This expands to the `user` time of `time`. 201 202 ### Prompt sequence `\q{contrib/elapsed-sys}` 203 204 This expands to the `sys` time of `time`. 205 206 ### Prompt sequence `\q{contrib/elapsed-cpu}` 207 208 This expands to the average cpu usage. 209 210 ## :pencil: colorglass 211 212 If your terminal supports the 24-bit color, you can adjust the theme colors by specifying gamma, contrast, hue rotation, etc. 213 This also works for the terminals without the 24-bit color if `bleopt term_true_colors` is properly set up, but the resulting colors would be reduced to a smaller number of colors. 214 215 ```bash 216 ble-import contrib/colorglass 217 218 # If your terminal does not support the 24-bit colors, please explicitly 219 # configure it by putting the following line: 220 #bleopt term_true_colors= 221 ``` 222 223 ### Blopet colorglass_gamma 224 225 This option specifies the change of gamma by percentage. 226 For example, `bleopt colorglass_gamma=5` performs the gamma correction with $\gamma=1.05$, and `bleopt colorglass_gamma=-5` performs the gamma correction with $\gamma=0.95$ 227 228 ```bash 229 # default 230 bleopt colorglass_gamma=0 231 ``` 232 233 ### Blopet colorglass_contrast 234 235 This option specifies the contrast modification in the range -100..100. 236 237 ```bash 238 # default 239 bleopt colorglass_contrast=0 240 ``` 241 242 ### Blopet colorglass_rotate 243 244 This option specifies the angle of hue rotation in degrees. 245 246 ```bash 247 # default 248 bleopt colorglass_rotate=0 249 ``` 250 251 ### Blopet colorglass_saturation 252 253 This option specifies the change of saturation in the range -100..100.. 254 255 ```bash 256 # default 257 bleopt colorglass_saturation=0 258 ``` 259 260 ### Blopet colorglass_brightness 261 262 This option specifies the change of brightness in the range -100..100.. 263 264 ```bash 265 # default 266 bleopt colorglass_brightness=0 267 ``` 268 269 ### Blopet colorglass_alpha 270 271 This option specifies the opacity in the range 0..255 when the color is synthesized with the background color specified by `bleopt colorglass_color`. 272 273 ```bash 274 # defualt 275 bleopt colorglass_alpha=255 276 ``` 277 278 ### Blopet colorglass_color 279 280 This option specifies the background color used by the color synthesis by `bleopt colorglass_alpha`. 281 282 ```bash 283 # defualt 284 bleopt colorglass_color=0x8888FF 285 ```