Skip to content

feat/making plugin padding customizable #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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" " ")

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