|
5 | 5 | let s:exit_code = -1
|
6 | 6 |
|
7 | 7 | func tpipeline#get_filepath()
|
8 |
| - " e.g. /tmp/tmux-1000/default-$0-vimbridge |
9 |
| - let tmux = $TMUX |
10 |
| - if empty(tmux) |
11 |
| - let p = "/tmp/tmux-" . systemlist("id -u")[-1] |
| 8 | + |
| 9 | + if !empty($ZELLIJ) |
| 10 | + " e.g. /tmp/zjstatus-$UID/$SESSION_NAME-$PANE_ID-vimbridge |
| 11 | + let p = "/tmp/zjstatus-" . systemlist("id -u")[-1] |
12 | 12 | silent! call mkdir(p)
|
13 |
| - let tmux = p . "/default,0,0" |
| 13 | + let session = $ZELLIJ_SESSION_NAME |
| 14 | + " TODO: wait for https://github.com/zellij-org/zellij/issues/2835 |
| 15 | + " so we can identify the currently active pane. Now I have to hardcode it |
| 16 | + " to zjstatus - so no reason to use the variable here, yet. |
| 17 | + " let paneid = $ZELLIJ_PANE_ID |
| 18 | + let paneid = "0" |
| 19 | + let p = p . "/" |
| 20 | + let zellij = p . session . "-" . paneid . "-vimbridge" |
| 21 | + return zellij |
| 22 | + endif |
| 23 | + |
| 24 | + |
| 25 | + if !empty($TMUX) |
| 26 | + " e.g. /tmp/tmux-1000/default-$0-vimbridge |
| 27 | + let tmux = $TMUX |
| 28 | + if empty(tmux) |
| 29 | + let p = "/tmp/tmux-" . systemlist("id -u")[-1] |
| 30 | + silent! call mkdir(p) |
| 31 | + let tmux = p . "/default,0,0" |
| 32 | + endif |
| 33 | + return strcharpart(tmux, 0, stridx(tmux, ",")) . '-$' . strcharpart(tmux, strridx(tmux, ",") + 1) . '-vimbridge' |
14 | 34 | endif
|
15 |
| - return strcharpart(tmux, 0, stridx(tmux, ",")) . '-$' . strcharpart(tmux, strridx(tmux, ",") + 1) . '-vimbridge' |
16 | 35 | endfunc
|
17 | 36 |
|
18 | 37 | func tpipeline#build_hooks()
|
@@ -169,6 +188,7 @@ func tpipeline#exit_cb(job, code)
|
169 | 188 | endfunc
|
170 | 189 |
|
171 | 190 | func tpipeline#fork_job()
|
| 191 | + " TODO: for ZELLIJ, only do what is necessary |
172 | 192 | if g:tpipeline_restore
|
173 | 193 | let s:restore_left = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-left}\"'")[-1]
|
174 | 194 | let s:restore_right = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-right}\"'")[-1]
|
|
0 commit comments