@@ -78,6 +78,12 @@ if exists("g:scSplitSize")
78
78
let s: scSplitSize = g: scSplitSize
79
79
endif
80
80
81
+
82
+ let s: scTerminalBuffer = " off"
83
+ if exists (" g:scTerminalBuffer" )
84
+ let s: scTerminalBuffer = g: scTerminalBuffer
85
+ endif
86
+
81
87
" ========================================================================================
82
88
83
89
function ! FindOuterMostBlock ()
@@ -219,13 +225,39 @@ endfunction
219
225
220
226
let s: sclangStarted = 0
221
227
228
+ function s: TerminalEnabled ()
229
+ return exists (" :term" ) && (s: scTerminalBuffer == " on" )
230
+ endfunction
231
+
232
+ function s: KillSClangBuffer ()
233
+ if bufexists (bufname (' start_pipe' ))
234
+ exec ' bd! start_pipe'
235
+ endif
236
+ endfunction
237
+
222
238
function SClangStart (... )
223
239
let l: tmux = exists (' $TMUX' )
224
240
let l: screen = exists (' $STY' )
225
- if l: tmux || l: screen
226
- let l: splitDir = (a: 0 == 2 ) ? a: 1 : s: scSplitDirection
227
- let l: splitSize = (a: 0 == 2 ) ? a: 2 : s: scSplitSize
228
-
241
+ let l: splitDir = (a: 0 == 2 ) ? a: 1 : s: scSplitDirection
242
+ let l: splitSize = (a: 0 == 2 ) ? a: 2 : s: scSplitSize
243
+ if s: TerminalEnabled ()
244
+ let l: term = " :term "
245
+ if ! has (" nvim" )
246
+ let l: term .= " ++curwin ++close "
247
+ endif
248
+ let l: isVertical = l: splitDir == " v"
249
+ let l: splitCmd = (l: isVertical ) ? " vsplit" : " split"
250
+ let l: resizeCmd = (l: isVertical ) ? " vertical resize " : " resize "
251
+ vsplit
252
+ wincmd w
253
+ call s: KillSClangBuffer ()
254
+ exec " vertical resize " .(l: splitSize * 2 ) ." %"
255
+ exec " set wfw"
256
+ exec " set wfh"
257
+ exec l: term .s: sclangPipeApp
258
+ exec " normal G"
259
+ wincmd w
260
+ elseif l: tmux || l: screen
229
261
if l: tmux
230
262
let l: cmd = " tmux split-window -" . l: splitDir . " -p " . l: splitSize . " ;"
231
263
let l: cmd .= " tmux send-keys " . s: sclangPipeApp . " Enter ; tmux select-pane -l"
@@ -241,16 +273,17 @@ function SClangStart(...)
241
273
call system (" screen -S " . l: screenName . " -X resize " . l: splitSize . ' %' )
242
274
call system (" screen -S " . l: screenName . " -X bindkey -k k5" )
243
275
endif
244
-
245
276
else
246
277
call system (s: sclangTerm . " " . s: sclangPipeApp . " &" )
247
278
endif
248
-
249
279
let s: sclangStarted = 1
250
280
endfunction
251
281
252
282
function SClangKill ()
253
283
call system (s: sclangDispatcher . " -q" )
284
+ if has (" nvim" )
285
+ call s: KillSClangBuffer ()
286
+ endif
254
287
endfunction
255
288
256
289
function SClangKillIfStarted ()
0 commit comments