Skip to content

Commit

Permalink
executioner.vim 1.2.4
Browse files Browse the repository at this point in the history
Fix horizontal and vertical buffers without terminal window support not
working as intended.
  • Loading branch information
EvanQuan committed Dec 25, 2018
1 parent ff54911 commit f4e5b02
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions plugin/executioner.vim
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
" ============================================================================
" File: executioner.vim
" Maintainer: https://github.com/EvanQuan/vim-executioner/
" Version: 1.2.3
" Version: 1.2.4
"
" A Vim plugin to easily execute files in the terminal or a separate buffer.
" You can learn more about it with:
"
" :help executioner
"
" ============================================================================

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

" Fake enums

" Parsed input
let s:FILE = 0
let s:NAME = 1
Expand All @@ -43,6 +45,8 @@ let s:NAME_COMMAND = 1

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

let s:has_teriminal = has("terminal")

" extension : command
" Command is executed if file has specified extension
if !exists("g:executioner#extensions")
Expand Down Expand Up @@ -181,11 +185,6 @@ function! s:Substitute(string, old, new) abort
let s:new_string = ""
for i in range(len(a:string))
let s:new_string .= a:string[i] == a:old ? a:new : a:string[i]
" if a:string[i] == a:old
" let s:new_string .= a:new
" else
" let s:new_string .= a:string[i]
" endif
endfor
return s:new_string
endfunction
Expand Down Expand Up @@ -236,10 +235,10 @@ function! s:GetSplitPrefix(split_type) abort

" If terminal is available, use just the built-in terminal. Otherwise,
" run the command in command-mode terminal and redirect output to buffer.
let s:split_prefix = has("terminal") && a:split_type != s:NONE ?
let s:split_prefix = s:has_teriminal && a:split_type != s:NONE ?
\ (a:split_type == s:VERTICAL ? "vertical " : "") . "terminal "
\ :
\ a:split_type != s:NONE ? "." : ""
\ (a:split_type != s:NONE ? "." : "")
\ . "!"
return s:split_prefix
endfunction
Expand All @@ -250,15 +249,15 @@ function! s:ExecuteCommand(split_type, final_command, file_name) abort

" echom "in ExecuteCommand"
" Check for terminal
if has("terminal")
if s:has_teriminal || (!s:has_teriminal && a:split_type == s:NONE)
" echom "ExecuteCommand: has terminal"
execute a:final_command
" execute shellescape(a:final_command, 1)
" echom "final_command: " . s:final_command
" echom "ExecuteCommand: no terminal"

" Manually create a readonly buffer if terminal is not supported
elseif a:split_type != s:NONE
else
let s:buffer_split = s:split_type == s:VERTICAL ? 'vertical' : 'botright'

let s:output_buffer_name = "Output"
Expand Down

0 comments on commit f4e5b02

Please sign in to comment.