summaryrefslogtreecommitdiffstats
path: root/autoload/dart.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/dart.vim')
-rw-r--r--autoload/dart.vim10
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.
"