Skip to content

Commit d601fd8

Browse files
authored
add g:tpipeline_usepane option (#22)
by default the vim statusline embeds into the tmux status bar. this option will set the tmux pane title instead. Co-authored-by: Andrey Kaipov <[email protected]>
1 parent d320536 commit d601fd8

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

autoload/tpipeline.vim

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ func tpipeline#initialize()
4747
if !exists('g:tpipeline_fillcentre')
4848
let g:tpipeline_fillcentre = 0
4949
endif
50+
if !exists('g:tpipeline_usepane')
51+
let g:tpipeline_usepane = 0
52+
endif
5053
if !exists('g:tpipeline_autoembed')
5154
let g:tpipeline_autoembed = 1
5255
endif
@@ -120,19 +123,27 @@ func tpipeline#fork_job()
120123
let s:restore_right = system("tmux display-message -p '#{status-right}'")
121124
endif
122125
let script = printf("while IFS='$\\n' read -r l; do echo \"$l\" > '%s'", s:tpipeline_filepath)
126+
if g:tpipeline_usepane
127+
" end early if file was truncated so as not to overwrite any
128+
" titles of panes we may switch to
129+
let script .= "; if [ -z \"$l\" ]; then continue; fi"
130+
endif
123131
if g:tpipeline_autoembed
124132
for o in g:tpipeline_embedopts
125133
let script = 'tmux set -g ' . o . '; ' . script
126134
endfor
127135
endif
128136
if g:tpipeline_fillcentre
129137
let script .= "; C=$(echo \"$l\" | grep -o 'bg=#[0-9a-f]\\{6\\}'| tail -1)"
138+
if !g:tpipeline_usepane
139+
let script .= "; tmux set -g status-style \"$C\""
140+
endif
130141
endif
131142
if g:tpipeline_split
132-
let script .= printf("; IFS='$\\n' read -r l; echo \"$l\" > '%s'", s:tpipeline_right_filepath)
143+
let script .= printf("; IFS='$\\n' read -r r; echo \"$r\" > '%s'", s:tpipeline_right_filepath)
133144
endif
134-
if g:tpipeline_fillcentre
135-
let script .= "; tmux set -g status-style \"$C\""
145+
if g:tpipeline_usepane
146+
let script .= "; tmux select-pane -T \"#[fill=${C:3}]#[align=left]$l#[align=right]$r\""
136147
endif
137148
let script .= "; tmux refresh-client -S; done"
138149

doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ g:tpipeline_restore tpipeline.txt /*g:tpipeline_restore*
99
g:tpipeline_split tpipeline.txt /*g:tpipeline_split*
1010
g:tpipeline_statusline tpipeline.txt /*g:tpipeline_statusline*
1111
g:tpipeline_tabline tpipeline.txt /*g:tpipeline_tabline*
12+
g:tpipeline_usepane tpipeline.txt /*g:tpipeline_usepane*
1213
tpipeline tpipeline.txt /*tpipeline*
1314
tpipeline#state#freeze() tpipeline.txt /*tpipeline#state#freeze()*
1415
tpipeline#state#thaw() tpipeline.txt /*tpipeline#state#thaw()*

doc/tpipeline.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ Configuration *tpipeline-configure*
137137
it will restore the tmux statusline to its previous state
138138
after quitting vim. This feature is disabled by default.
139139

140+
g:tpipeline_usepane *g:tpipeline_usepane*
141+
By default |tpipeline| embeds your vim statusline into your
142+
tmux status bar. Enabling this option will set the tmux
143+
`pane_title` variable to your vim statusline, effectively
144+
embedding the statusline into your active pane border provided
145+
`pane-border-status` and `pane-border-format` are set
146+
accordingly. For example:
147+
>
148+
set -g pane-border-status top
149+
set -g pane-border-format '#{pane_title}'
150+
<
151+
140152
------------------------------------------------------------------------------
141153
Api *tpipeline-api*
142154

0 commit comments

Comments
 (0)