| 1 | # ⚙ Prompt sequences |
| 2 | |
| 3 | ## :pencil: `contrib/prompt-vim-mode` |
| 4 | |
| 5 | Source: [`prompt-vim-mode.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-vim-mode.bash) |
| 6 | |
| 7 | ### Prompt sequence `\q{contrib/vim-mode}` |
| 8 | |
| 9 | This prompt sequence expands to the vim mode name. |
| 10 | |
| 11 | ```bash |
| 12 | # blerc (example) |
| 13 | |
| 14 | ble-import contrib/prompt-vim-mode |
| 15 | PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' # show mode name in PS1 |
| 16 | bleopt keymap_vi_mode_show:= # hide mode line |
| 17 | ``` |
| 18 | |
| 19 | ## :pencil: `contrib/prompt-git` |
| 20 | |
| 21 | Source: [`prompt-git.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-git.bash) |
| 22 | |
| 23 | ```bash |
| 24 | # blerc (example) |
| 25 | |
| 26 | ble-import contrib/prompt-git |
| 27 | bleopt prompt_rps1='\q{contrib/git-info}' |
| 28 | ``` |
| 29 | |
| 30 | ### Prompt sequence `\q{contrib/git-info}` |
| 31 | |
| 32 | This expands to a string that explains the current git status. |
| 33 | |
| 34 | ### Prompt sequence `\q{contrib/git-name}` |
| 35 | |
| 36 | This expands to the directory name of the repository. |
| 37 | |
| 38 | ### Prompt sequence `\q{contrib/git-hash N}` |
| 39 | |
| 40 | This expands to the commit hash. |
| 41 | The hash is truncated to the length `N`. |
| 42 | The default value for `N` is `7`. |
| 43 | |
| 44 | ### Prompt sequence `\q{contrib/git-branch}` |
| 45 | |
| 46 | This expands to the branch name (or tag name or hash) of `HEAD`. |
| 47 | |
| 48 | ### Prompt sequence `\q{contrib/git-path}` |
| 49 | |
| 50 | This expands to the current path relative to the root directory of the repository. |
| 51 | |
| 52 | ## :pencil: `contrib/prompt-elapsed` |
| 53 | |
| 54 | Source: [`prompt-elapsed.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-elapsed.bash) |
| 55 | |
| 56 | Measures the time of the previous command execution. |
| 57 | |
| 58 | ```bash |
| 59 | # blerc (example) |
| 60 | |
| 61 | ble-import contrib/prompt-elapsed |
| 62 | bleopt prompt_rps1='\g{fg=69,italic}\q{contrib/elapsed}' |
| 63 | ``` |
| 64 | |
| 65 | ### Prompt sequence `\q{contrib/elapsed}` |
| 66 | |
| 67 | This expands to the high-resolution elapsed time for the command execution. |
| 68 | |
| 69 | ### Prompt sequence `\q{contrib/elapsed-real}` |
| 70 | |
| 71 | This expands to the `real` time of `time`. |
| 72 | |
| 73 | ### Prompt sequence `\q{contrib/elapsed-user}` |
| 74 | |
| 75 | This expands to the `user` time of `time`. |
| 76 | |
| 77 | ### Prompt sequence `\q{contrib/elapsed-sys}` |
| 78 | |
| 79 | This expands to the `sys` time of `time`. |
| 80 | |
| 81 | ### Prompt sequence `\q{contrib/elapsed-cpu}` |
| 82 | |
| 83 | This expands to the average cpu usage. |