From c19289da2e8633ab035da93d04df90539315075e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20M=2E=20Taveras?= Date: Thu, 25 Apr 2024 23:10:30 -0400 Subject: [PATCH] plugins/xterm: Fix usage description Co-authored-by: Koichi Murase --- plugins/xterm/README.md | 47 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/plugins/xterm/README.md b/plugins/xterm/README.md index 030e4fa..7ad428e 100644 --- a/plugins/xterm/README.md +++ b/plugins/xterm/README.md @@ -1,48 +1,47 @@ -### Plugin xterm +# Xterm Plugin -#### Description +## Description This script automatically sets your xterm title with host and location information. It dynamically updates the title to reflect the current user, host, directory, and command being executed. -#### Source +## Source You can find the original source of this script [here](https://github.com/Bash-it/bash-it/blob/bf2034d13d/plugins/available/xterm.plugin.bash). -#### Variables +## Variables - `PROMPT_CHAR` (optional): This variable is shared with powerline. - `OMB_PLUGIN_XTERM_SHORT_TERM_LINE` (optional): Controls whether to shorten the directory name in the title. - `OMB_PLUGIN_XTERM_SHORT_USER` (optional): Overrides the default user name. - `OMB_PLUGIN_XTERM_SHORT_HOSTNAME` (optional): Overrides the default hostname. -#### Functions - -1. **`_omb_plugin_xterm_set_title`** +## Functions +1. **`set_xterm_title`** - Sets the xterm title with the provided string. -2. **`_omb_plugin_xterm_precmd_title`** +## Usage - - Updates the xterm title before executing a command. - - Includes the user, host, directory, and prompt character. +1. **Enable plugin:** -3. **`_omb_plugin_xterm_preexec_title`** + - Add the plugin name `xterm` in the `plugins` array in `~/.bashrc`. - - Updates the xterm title after executing a command. - - Includes the user, host, directory, and the first part of the executed command. + ```shell + # bashrc -4. **`set_xterm_title`** - - Manually sets the xterm title with the provided string. - -#### Usage - -1. **Installation:** - - - Add this script to your shell configuration file (e.g., `.bashrc`, `.bash_profile`). + plugins=(... xterm) + ``` 2. **Customization:** - - Modify the variables and functions as needed to fit your preferences. + - Modify the variables and functions as needed to fit your preferences. -3. **Execution:** - - The xterm title will automatically update based on your commands and directory changes. +The xterm title will be automatically updated based on your commands and directory changes. + +_⚠️ if you want to add only this plugin and not Oh My Bash, you can copy the +file `xterm.plugin.bash` in a place you like and edit the file to comment out +the line `_omb_module_require plugin:bash-preexec`. Then, source +`xterm.plugin.bash` in `~/.basrhc` (for interactive uses) or in a shell script +(for a standalone shell program). You may instead copy and paste the functions +directly into a script file, in which case the plugin will not receive updates +and possible errors will have to be solved by you_