diff options
| author | Mitermayer Reis <mitermayer.reis@gmail.com> | 2020-01-08 13:08:21 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-08 13:08:21 -0800 |
| commit | f4e31d67aa1e0658c1a19a26e4bad9fc4691eab9 (patch) | |
| tree | e5f9a74d33ad77cfbf77a19f44eee828b1aedce8 /autoload | |
| parent | 9c216df3a57d35dc90222473a3438697624c9a4f (diff) | |
| parent | e144afaa17a5c4069c9b86558a2831e729429073 (diff) | |
| download | vim-prettier-f4e31d67aa1e0658c1a19a26e4bad9fc4691eab9.tar.xz | |
Merge pull request #212 from atomdmac/toggle-autoformat-by-config
Toggle the autoformat setting based on config file presence.
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/prettier.vim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim index e66f4b7..d4c3171 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -78,3 +78,13 @@ function! prettier#Prettier(...) abort call prettier#logging#error#log('EXECUTABLE_NOT_FOUND_ERROR') endif endfunction + +" Set autoformat toggle based on whether config file was found. +function! prettier#IsConfigPresent(config_files) abort + for config_file in a:config_files + if filereadable(findfile(config_file, '.;')) + return 1 + endif + endfor + return 0 +endfunction |
