From 3e0c887365bc1ebd55b91dd69ab73f2dee1f00ed Mon Sep 17 00:00:00 2001 From: Dan Reif Date: Mon, 30 Apr 2018 12:00:42 -0700 Subject: 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. --- autoload/dart.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'autoload/dart.vim') 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. " -- cgit v1.2.3