Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ Hide empty plugins
set -g @dracula-show-empty-plugins false
```

Set plugin padding
Whilst the padding is one space per default, can be whatever you want it to be, whether that's whitespace or other characters.
**If you want to remove any padding, you need to use a zero width space!**

```bash
set -g @dracula-left-pad ' ° '
set -g @dracula-right-pad ' ° '
# no padding with zero width space
set -g @dracula-left-pad '​'
set -g @dracula-right-pad '​'
```

### Powerline - [up](#table-of-contents)

Enable powerline symbols
Expand Down
13 changes: 9 additions & 4 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ main() {
show_ssh_session_port=$(get_tmux_option "@dracula-show-ssh-session-port" false)
show_libreview=$(get_tmux_option "@dracula-show-libreview" false)
show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true)
left_pad=$(get_tmux_option "@dracula-left-pad" " ")
right_pad=$(get_tmux_option "@dracula-right-pad" " ")

Comment on lines +41 to 43
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Leading / trailing-space padding is silently stripped – quote command substitutions.

get_tmux_option may legitimately return strings that start or end with spaces (e.g. ' ° ' in the docs).
Because the result of a command-substitution is subject to word-splitting, the assignment

left_pad=$(get_tmux_option "@dracula-left-pad" " ")

drops those leading / trailing blanks – they never make it into left_pad / right_pad.

- left_pad=$(get_tmux_option "@dracula-left-pad" " ")
- right_pad=$(get_tmux_option "@dracula-right-pad" " ")
+ left_pad="$(get_tmux_option "@dracula-left-pad" " ")"
+ right_pad="$(get_tmux_option "@dracula-right-pad" " ")"

Quoting preserves the exact byte sequence the user configured (including zero-width spaces).
Same issue exists anywhere we later read the option back; fixing it here is sufficient.

🤖 Prompt for AI Agents
In scripts/dracula.sh around lines 41 to 43, the command substitutions assigning
left_pad and right_pad are unquoted, causing leading and trailing spaces to be
stripped due to word splitting. To fix this, wrap the command substitutions in
double quotes like left_pad="$(get_tmux_option "@dracula-left-pad" " ")" and
right_pad="$(get_tmux_option "@dracula-right-pad" " ")" to preserve all
whitespace exactly as returned.

narrow_mode=$(get_tmux_option "@dracula-narrow-mode" false)
if $narrow_mode; then
Expand Down Expand Up @@ -361,18 +363,21 @@ main() {
background_color=${powerbg}
fi

# padding
pad_script="$left_pad$script$right_pad"

if $show_powerline; then
if $show_empty_plugins; then
tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon"
tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script$right_edge_icon"
else
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}"
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script$right_edge_icon}"
fi
powerbg=${!colors[0]}
else
if $show_empty_plugins; then
tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}] $script "
tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script"
else
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}] $script }"
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script}"
fi
fi

Expand Down