diff --git a/ftplugin/ats.vim b/ftplugin/ats.vim index 9071bfe..91ea825 100644 --- a/ftplugin/ats.vim +++ b/ftplugin/ats.vim @@ -14,9 +14,11 @@ au BufNewFile,BufRead *.*ats setlocal commentstring=(*\ %s\ *) function! AtsFormat() + let cursor = getpos('.') exec 'normal! gg' exec 'silent !atsfmt -i ' . expand('%') exec 'e' + call setpos('.', cursor) endfunction if g:ats_autoformat == 1