Blank lines at the end of the file
paddycarver opened this issue · 7 comments
Every time :JSFmt
is called (including on save), an empty line is appended to the end of the file, regardless of whether the file ends in an empty line or not. This leads to steadily-increasing files, with a new line added for every save.
I've run the jsfmt
command on the files outside of vim, and can verify this behaviour does not appear there.
I'm using jsfmt 0.3.2 and the latest (0f648a8) version of vim-jsfmt. vim --version
spits out VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 24 2013 18:58:47)
.
@paddyforan this has been fixed with pull request #3
was this patch removed? I'm getting extras lines again. Using jsfmt 0.4.0.
Adding $delete helped again:
diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim
index db06204..fc00948 100644
--- a/ftplugin/javascript.vim
+++ b/ftplugin/javascript.vim
@@ -60,6 +60,7 @@ function! s:JSFormat()
" NO ERROR
try | silent undojoin | catch | endtry
silent execute "%!" . command
+ $delete
" only clear quickfix if it was previously set, this prevents closing
" other quickfixs
👍 can confirm adding back in $delete fixed the issue.
On jsfmt 0.4.1 it needs to be removed again. everything works fine than.
roger, thanks all