aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authormitermayer <mitermayer.reis@gmail.com>2017-05-30 21:42:01 -0700
committermitermayer <mitermayer.reis@gmail.com>2017-05-31 13:12:07 -0700
commit20fcb11b0c24be63fe4321a8aaf01e3d46730016 (patch)
tree8e27897d21456b638b95d3cbf5756ce01d146b32 /autoload
parent7c4f26b106fcf25d4d24c116f91b8cc422d8daed (diff)
downloadvim-prettier-20fcb11b0c24be63fe4321a8aaf01e3d46730016.tar.xz
Moving executable check up
Diffstat (limited to 'autoload')
-rw-r--r--autoload/prettier.vim14
1 files changed, 5 insertions, 9 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim
index 37f0a73..7e6e90a 100644
--- a/autoload/prettier.vim
+++ b/autoload/prettier.vim
@@ -132,17 +132,17 @@ endfunction
" => if all fails suggest install
function! s:Get_Prettier_Exec() abort
let l:local_exec = s:Get_Prettier_Local_Exec()
- if local_exec != -1
+ if executable(local_exec)
return local_exec
endif
let l:global_exec = s:Get_Prettier_Global_Exec()
- global_exec != -1
+ if executable(l:global_exec)
return global_exec
endif
let l:plugin_exec = s:Get_Prettier_Plugin_Exec()
- if plugin_exec != -1
+ if executable(l:plugin_exec)
return plugin_exec
endif
@@ -163,7 +163,7 @@ endfunction
function! s:Get_Exec(...) abort
let l:rootDir = a:0 > 0 ? a:1 : 0
- let l:exec = 0
+ let l:exec = -1
if isdirectory(rootDir)
let l:dir = s:Tranverse_Dir_Search(rootDir)
@@ -174,11 +174,7 @@ function! s:Get_Exec(...) abort
let l:exec = s:Get_Path_To_Exec()
endif
- if executable(exec)
- return exec
- endif
-
- return -1
+ return exec
endfunction
function! s:Get_Path_To_Exec(...) abort