Skip to content

Commit f4e5b02

Browse files
committed
executioner.vim 1.2.4
Fix horizontal and vertical buffers without terminal window support not working as intended.
1 parent ff54911 commit f4e5b02

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

plugin/executioner.vim

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
" ============================================================================
22
" File: executioner.vim
33
" Maintainer: https://github.com/EvanQuan/vim-executioner/
4-
" Version: 1.2.3
4+
" Version: 1.2.4
55
"
66
" A Vim plugin to easily execute files in the terminal or a separate buffer.
7+
" You can learn more about it with:
8+
"
9+
" :help executioner
10+
"
711
" ============================================================================
812

913
if exists("g:executioner#loaded")
@@ -23,8 +27,6 @@ if !exists("g:executioner#load_defaults")
2327
let g:executioner#load_defaults = 1
2428
endif
2529

26-
" Fake enums
27-
2830
" Parsed input
2931
let s:FILE = 0
3032
let s:NAME = 1
@@ -43,6 +45,8 @@ let s:NAME_COMMAND = 1
4345

4446
let s:DIRECTORY_SEPARATOR = '[/\\]'
4547

48+
let s:has_teriminal = has("terminal")
49+
4650
" extension : command
4751
" Command is executed if file has specified extension
4852
if !exists("g:executioner#extensions")
@@ -181,11 +185,6 @@ function! s:Substitute(string, old, new) abort
181185
let s:new_string = ""
182186
for i in range(len(a:string))
183187
let s:new_string .= a:string[i] == a:old ? a:new : a:string[i]
184-
" if a:string[i] == a:old
185-
" let s:new_string .= a:new
186-
" else
187-
" let s:new_string .= a:string[i]
188-
" endif
189188
endfor
190189
return s:new_string
191190
endfunction
@@ -236,10 +235,10 @@ function! s:GetSplitPrefix(split_type) abort
236235

237236
" If terminal is available, use just the built-in terminal. Otherwise,
238237
" run the command in command-mode terminal and redirect output to buffer.
239-
let s:split_prefix = has("terminal") && a:split_type != s:NONE ?
238+
let s:split_prefix = s:has_teriminal && a:split_type != s:NONE ?
240239
\ (a:split_type == s:VERTICAL ? "vertical " : "") . "terminal "
241240
\ :
242-
\ a:split_type != s:NONE ? "." : ""
241+
\ (a:split_type != s:NONE ? "." : "")
243242
\ . "!"
244243
return s:split_prefix
245244
endfunction
@@ -250,15 +249,15 @@ function! s:ExecuteCommand(split_type, final_command, file_name) abort
250249

251250
" echom "in ExecuteCommand"
252251
" Check for terminal
253-
if has("terminal")
252+
if s:has_teriminal || (!s:has_teriminal && a:split_type == s:NONE)
254253
" echom "ExecuteCommand: has terminal"
255254
execute a:final_command
256255
" execute shellescape(a:final_command, 1)
257256
" echom "final_command: " . s:final_command
258257
" echom "ExecuteCommand: no terminal"
259258

260259
" Manually create a readonly buffer if terminal is not supported
261-
elseif a:split_type != s:NONE
260+
else
262261
let s:buffer_split = s:split_type == s:VERTICAL ? 'vertical' : 'botright'
263262

264263
let s:output_buffer_name = "Output"

0 commit comments

Comments
 (0)