diff options
author | Dan Reif <dan.reif@collectivehealth.com> | 2018-04-30 12:00:42 -0700 |
---|---|---|
committer | Dan Reif <dan.reif@collectivehealth.com> | 2018-04-30 12:00:42 -0700 |
commit | 3e0c887365bc1ebd55b91dd69ab73f2dee1f00ed (patch) | |
tree | ce76003a08274cb805df101a44be8d37af1a4c4b /autoload/dart.vim | |
parent | b4d7993e7ea554153025c5072749f415e69e0323 (diff) | |
download | vim-polyglot-3e0c887365bc1ebd55b91dd69ab73f2dee1f00ed.tar.gz vim-polyglot-3e0c887365bc1ebd55b91dd69ab73f2dee1f00ed.zip |
Update (periodic rebuild)
I originally meant to run this before adding haproxy, but accidentally
pushed that into my branch. If you'd like to see that content, it's at
https://github.com/CH-DanReif/vim-polyglot/commit/414ad25c3ad1ab9c4b6a99fe4f08d6c30b7e0f57.
Diffstat (limited to 'autoload/dart.vim')
-rw-r--r-- | autoload/dart.vim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/autoload/dart.vim b/autoload/dart.vim index 2ff55cb6..0e8fb525 100644 --- a/autoload/dart.vim +++ b/autoload/dart.vim @@ -22,6 +22,7 @@ function! dart#fmt(q_args) abort if executable('dartfmt') let buffer_content = join(getline(1, '$'), "\n") let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content) + if buffer_content ==# joined_lines[:-2] | return | endif if 0 == v:shell_error let win_view = winsaveview() let lines = split(joined_lines, "\n") @@ -129,6 +130,15 @@ function! s:PackageMap() abort return [v:true, map] endfunction +" Toggle whether dartfmt is run on save or not. +function! dart#ToggleFormatOnSave() abort + if get(g:, "dart_format_on_save", 0) + let g:dart_format_on_save = 0 + return + endif + let g:dart_format_on_save = 1 +endfunction + " Finds a file name '.packages' in the cwd, or in any directory above the open " file. " |