diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2018-05-02 22:45:49 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2019-08-25 21:11:49 -0700 |
| commit | 6ee597f64fb037d0e15e1a284ae93c4ab2d3f659 (patch) | |
| tree | 611aa83fdc4d60247890f99ba5230127a649ec24 | |
| parent | 37b5542b663702d5ed44c663359740dcae4de34d (diff) | |
| download | vim-prettier-6ee597f64fb037d0e15e1a284ae93c4ab2d3f659.tar.xz | |
Creating shim utils to handle backwards compatiblity functions
- Movingthe shiftwidth compat helper to a shim module responsible for
dealing with backwards compatiblity
| -rw-r--r-- | autoload/prettier.vim | 11 | ||||
| -rw-r--r-- | autoload/prettier/utils/shim.vim | 8 |
2 files changed, 9 insertions, 10 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim index c6b89fd..d7c4338 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -273,21 +273,12 @@ function! s:Flag_use_tabs(config) abort endif endfunction -" Backwards compatable version of shiftwidth() -function! s:sw() abort - if exists('*shiftwidth') - return shiftwidth() - else - return &shiftwidth - endif -endfunction - " Returns '--tab-width=NN' function! s:Flag_tab_width(config) abort let l:value = get(a:config, 'tabWidth', g:prettier#config#tab_width) if (l:value ==# 'auto') - let l:value = s:sw() + let l:value = prettier#utils#shim#shiftwidth() endif return '--tab-width=' . l:value diff --git a/autoload/prettier/utils/shim.vim b/autoload/prettier/utils/shim.vim new file mode 100644 index 0000000..228829e --- /dev/null +++ b/autoload/prettier/utils/shim.vim @@ -0,0 +1,8 @@ +" Backwards compatable version of shiftwidth() +function! prettier#utils#shim#shiftwidth() abort + if exists('*shiftwidth') + return shiftwidth() + else + return &shiftwidth + endif +endfunction |
