Skip to content

Conversation

andreykaipov
Copy link
Contributor

First of all thanks so much for this plugin. Having two status bars per pane always bugged me.

This PR adds an option to use the vim statusline as the pane title.

I first tried by just embedding #(cat #{socket_path}-\#{session_id}-vimbridge) into the pane-border-format option, but this didn't work out too well because it applied to every pane border. Luckily it wasn't too difficult to get the behaviour I was looking for! Here's an example with the default lightline-esque statusline as the pane title with the following options:

let g:tpipeline_split = 1
let g:tpipeline_usepane = 1
let g:tpipeline_fillcentre = 1

image

It also works with a custom status line too (that can be colored in the pane-border-format):

image

Copy link
Owner

@vimpostor vimpostor left a comment

Choose a reason for hiding this comment

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

Wow, very impressive! Overall the code looks very good, I just have a few minor nitpicks (see below).

If someone would have requested this feature in an issue, I would probably have been very much against it at first, especially since it is difficult to handle multiple pane status lines in a plugin that is all about one global statusline. But you solved the problem in a very clever and non-intrusive way.

Also you are an absolute madman for diving into that embedded shellscript dumpster fire that I wrote a while ago. It is not only incredibly cursed because it is literally shell script embedded inside vimscript, but because it uses so many conditions and has to escape so much stuff like \" etc... so it really is not easy to understand. Mad props for going through it and for expanding on it in a non-intrusive way.

BTW in the future we may be able to replace that ugly shellcode with the recently added native thread support, but for now the Job API + Bash script is the only way to reliably implement true async without adding dependencies.

Address my two minor nitpicks below and I think we can merge this.

by default the vim statusline embeds into the tmux status bar. this
option will set the tmux pane title instead.
@vimpostor
Copy link
Owner

LGTM, thank you very much for your contribution!
I think I might use this feature myself, this is pretty cool. :)

@vimpostor vimpostor merged commit d601fd8 into vimpostor:master Mar 9, 2022
@casonadams
Copy link

image

So I expanded on the idea of just moving all information into the pane-border remove the status line all together. Kind of neat thought I would share what I did.

  1. First I am using a new enough tmux where I have moved the config to ~/.config/tmux/tmux.conf
  2. Then I created a file called ~/.config/tmux/windows_list.sh that contains
#!/usr/bin/env bash

session="$(tmux display-message -p "#S")"
windows="$(tmux list-windows -F "#I:#W#F")"
mapfile -t array <<< "$windows"

formatted_windows=()

for item in "${array[@]}"
do
    if [[ $item == *"*"* ]]; then
        item="#[bold]$item#[default]"
    fi
    formatted_windows+=("$item")
done

joined=$(IFS=" "; echo "${formatted_windows[*]}")


printf "[%s] %s " "$session" "$joined"
  1. Setup tmux config
set-hook -g alert-activity 'selectp -T ""'
set-hook -g client-session-changed 'selectp -T ""'
set-hook -g after-split-window 'selectp -T ""'
set-hook -g after-new-window 'selectp -T ""'
set-hook -g after-new-session 'selectp -T ""'

set -g status off
set -g pane-border-status bottom
set -g pane-border-format "#{?pane_title,#{pane_title}, #($HOME/.config/tmux/windows_list.sh)}"

set -g status-style bg=color0,fg=color7
set -g window-status-style fg=color8,bg=color0
set -g window-status-last-style fg=color8,bg=color0
set -g window-status-current-style fg=color7,bold
set -g window-status-activity-style fg=color3

set -g pane-active-border-style fg=color4,bg=terminal
set -g pane-border-style fg=color8,bg=terminal
set -g mode-style fg=color0,bg=color4
set -g message-style fg=color4,bg=terminal
  1. Setup nvim
local g = vim.g

g.tpipeline_autoembed = 0
g.tpipeline_restore = 0
g.tpipeline_split = 1
g.tpipeline_usepane = 1
g.tpipeline_fillcentre = 1
g.tpipeline_cursormoved = 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants