Skip to content

Commit 411135d

Browse files
committed
Standardize on "generate config" over "generate rc" verbage.
Support for `~/.tmux-powerlinerc` was removed in [this commit](ebd2823), so it might be best to standardize on verbage around generation of `config.sh` file. Chose not to update naming for segment functions (i.e. `generate_segmentrc()`).
1 parent fa164e9 commit 411135d

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ Adapt the commands below if your paths differs from this.
143143
## Config file
144144
Start by generating your own configuration file:
145145
```shell
146-
~/.config/tmux/plugins/tmux-powerline/generate_rc.sh
146+
~/.config/tmux/plugins/tmux-powerline/generate_config.sh
147147
mv ~/.config/tmux-powerline/config.sh.default ~/.config/tmux-powerline/config.sh
148148
$EDITOR ~/.config/tmux-powerline/config.sh
149149
```
150150

151-
Go through the default config and adjust to you needs!
151+
Go through the default config and adjust to your needs!
152152

153153
## Custom theme
154154
The theme is specified by setting the environment variable `$TMUX_POWERLINE_THEME` in the config file above. It will use a default theme and you probably want to use your own. The default config have set the custom theme path to be `~/.config/tmux-powerline/themes/`.
@@ -237,7 +237,7 @@ This project can only gain positively from contributions. Fork today and make yo
237237
## How to make a segment
238238
If you want to (of course you do!) send a pull request for a cool segment you written make sure that it follows the style of existing segments, unless you have good reason for it. Each segment resides in the `segments/` directory with a descriptive and simple name. A segment must have at least one function and that is `run_segment` which is like the main function that is called from the tmux-powerline lib. What ever text is echoed out from this function to stdout is the text displayed in the tmux status bar. If the segment at a certain point does not have anything to show, simply don't echo anything out and the segment will be hidden. A successful execution of the `run_segment` function should return an exit code of 0. If the segment failed to execute in a fatal way return a non-zero exit code so the user can pick up the error and fix it when debug mode is on (e.g. missing program that is needed for the segment).
239239

240-
Usage of helper function to organize the work of a segment is encourage and should be named in the format `__helper_func`. If a segment has settings it should have a function `generate_rc` which outputs default values of all settings and a short explanation of the setting and its values. Study e.g. `segments/now_playing.sh` to see how it is done. A segment having settings should typically call a helper function `__process_settings` as the first statement in `run_segment` that sets default values to the settings that has not been set by the user.
240+
Usage of helper function to organize the work of a segment is encourage and should be named in the format `__helper_func`. If a segment has settings it should have a function `generate_segmentrc` which outputs default values of all settings and a short explanation of the setting and its values. Study e.g. `segments/now_playing.sh` to see how it is done. A segment having settings should typically call a helper function `__process_settings` as the first statement in `run_segment` that sets default values to the settings that has not been set by the user.
241241

242242
Also, don't use bash4 features as requiring bash4 complicates installation for macOS user quite a bit. Use tabs for indentation ([discussion](https://github.com/erikw/tmux-powerline/pull/92)),
243243

config/paths.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ export TMUX_POWERLINE_DIR_LIB="$TMUX_POWERLINE_DIR_HOME/lib"
44
export TMUX_POWERLINE_DIR_SEGMENTS="$TMUX_POWERLINE_DIR_HOME/segments"
55
export TMUX_POWERLINE_DIR_TEMPORARY="/tmp/tmux-powerline_${USER}"
66
export TMUX_POWERLINE_DIR_THEMES="$TMUX_POWERLINE_DIR_HOME/themes"
7-
if [ -z "$TMUX_POWERLINE_RCFILE" ]; then
8-
export TMUX_POWERLINE_RCFILE="${XDG_CONFIG_HOME:-$HOME/.config}/tmux-powerline/config.sh"
7+
if [ -z "$TMUX_POWERLINE_CONFIG_FILE" ]; then
8+
export TMUX_POWERLINE_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/tmux-powerline/config.sh"
99
fi
10-
export TMUX_POWERLINE_RCFILE_DEFAULT="${TMUX_POWERLINE_RCFILE}.default"
10+
export TMUX_POWERLINE_CONFIG_FILE_DEFAULT="${TMUX_POWERLINE_CONFIG_FILE}.default"
1111

12-
export TMUX_POWERLINE_RCDIR="$(dirname $TMUX_POWERLINE_RCFILE)"
12+
export TMUX_POWERLINE_CONFIG_DIR="$(dirname $TMUX_POWERLINE_CONFIG_FILE)"
1313

14-
if [ ! -d "$TMUX_POWERLINE_RCDIR" ] && [ ! -L "$TMUX_POWERLINE_RCDIR" ]; then
15-
mkdir -p "$TMUX_POWERLINE_RCDIR"
14+
if [ ! -d "$TMUX_POWERLINE_CONFIG_DIR" ] && [ ! -L "$TMUX_POWERLINE_CONFIG_DIR" ]; then
15+
mkdir -p "$TMUX_POWERLINE_CONFIG_DIR"
1616
fi
1717

1818
if [ ! -d "$TMUX_POWERLINE_DIR_TEMPORARY" ]; then
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
2-
# Generate default rc file.
2+
# Generate default config file.
33

44
export TMUX_POWERLINE_DIR_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
55

66
source "${TMUX_POWERLINE_DIR_HOME}/config/paths.sh"
77
source "${TMUX_POWERLINE_DIR_HOME}/config/defaults.sh"
88
source "${TMUX_POWERLINE_DIR_HOME}/config/shell.sh"
9-
source "${TMUX_POWERLINE_DIR_LIB}/rcfile.sh"
9+
source "${TMUX_POWERLINE_DIR_LIB}/config_file.sh"
1010

11-
generate_default_rc
11+
generate_default_config
1212

1313
exit 0

lib/rcfile.sh renamed to lib/config_file.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Read user rc file.
1+
# Read user config file.
22

33
process_settings() {
4-
__read_rcfile
4+
__read_config_file
55

66
if [ -z "$TMUX_POWERLINE_DEBUG_MODE_ENABLED" ]; then
77
export TMUX_POWERLINE_DEBUG_MODE_ENABLED="${TMUX_POWERLINE_DEBUG_MODE_ENABLED_DEFAULT}"
@@ -53,8 +53,8 @@ process_settings() {
5353

5454
}
5555

56-
generate_default_rc() {
57-
read -d '' rccontents << EORC
56+
generate_default_config() {
57+
read -d '' config_contents << EORC
5858
# Default configuration file for tmux-powerline.
5959
# Modeline {
6060
# vi: foldmarker={,} foldmethod=marker foldlevel=0 tabstop=4 filetype=sh
@@ -100,17 +100,17 @@ EORC
100100
segmentrc=$(generate_segmentrc | sed -e 's/^/\\t/g')
101101
unset -f generate_segmentrc
102102
local seg_name="${segment##*/}"
103-
rccontents="${rccontents}\n\n# ${seg_name} {\n${segmentrc}\n# }"
103+
config_contents="${config_contents}\n\n# ${seg_name} {\n${segmentrc}\n# }"
104104
fi
105105
done
106106

107-
echo -e "$rccontents" > "$TMUX_POWERLINE_RCFILE_DEFAULT"
108-
echo "Default configuration file generated to: ${TMUX_POWERLINE_RCFILE_DEFAULT}"
109-
echo "Copy/move it to \"${TMUX_POWERLINE_RCFILE}\" and make your changes."
107+
echo -e "$config_contents" > "$TMUX_POWERLINE_CONFIG_FILE_DEFAULT"
108+
echo "Default configuration file generated to: ${TMUX_POWERLINE_CONFIG_FILE_DEFAULT}"
109+
echo "Copy/move it to \"${TMUX_POWERLINE_CONFIG_FILE}\" and make your changes."
110110
}
111111

112-
__read_rcfile() {
113-
if [ -f "$TMUX_POWERLINE_RCFILE" ]; then
114-
source "$TMUX_POWERLINE_RCFILE"
112+
__read_config_file() {
113+
if [ -f "$TMUX_POWERLINE_CONFIG_FILE" ]; then
114+
source "$TMUX_POWERLINE_CONFIG_FILE"
115115
fi
116116
}

lib/headers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ source "${TMUX_POWERLINE_DIR_LIB}/arg_processing.sh"
1818
source "${TMUX_POWERLINE_DIR_LIB}/formatting.sh"
1919
source "${TMUX_POWERLINE_DIR_LIB}/muting.sh"
2020
source "${TMUX_POWERLINE_DIR_LIB}/powerline.sh"
21-
source "${TMUX_POWERLINE_DIR_LIB}/rcfile.sh"
21+
source "${TMUX_POWERLINE_DIR_LIB}/config_file.sh"

0 commit comments

Comments
 (0)