aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authormitermayer <mitermayer.reis@gmail.com>2017-09-25 22:28:45 -0700
committermitermayer <mitermayer.reis@gmail.com>2017-09-25 22:28:45 -0700
commitc880bd037e5768c4b4aaecee7a23df2a41c7c9ff (patch)
treee6aed0297f9dab77814b9d7f4829c2c39e066853 /autoload
parent9cc6c741d11fe5ac700f333a88881c9123f83f54 (diff)
downloadvim-prettier-c880bd037e5768c4b4aaecee7a23df2a41c7c9ff.tar.xz
issue/56 - Allowing user path overwrite configuration
Diffstat (limited to 'autoload')
-rw-r--r--autoload/prettier.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim
index 8ad30dc..c217a58 100644
--- a/autoload/prettier.vim
+++ b/autoload/prettier.vim
@@ -218,11 +218,17 @@ function! s:Get_Prettier_Exec_Args(config) abort
endfunction
" By default we will search for the following
+" => user defined prettier cli path from vim configuration file
" => locally installed prettier inside node_modules on any parent folder
" => globally installed prettier
" => vim-prettier prettier installation
" => if all fails suggest install
function! s:Get_Prettier_Exec() abort
+ let l:user_defined_exec_path = fnamemodify(g:prettier#exec_cmd_path, ':p')
+ if executable(l:user_defined_exec_path)
+ return l:user_defined_exec_path
+ endif
+
let l:local_exec = s:Get_Prettier_Local_Exec()
if executable(l:local_exec)
return l:local_exec