Skip to content
Browse files

Don't remove last line on syntax error

Closes #5.
  • Loading branch information...
1 parent 5481286 commit 9316641a5127154ba5b9c5cf2f9d4e81e2b03738 @henrik committed May 21, 2016
Showing with 8 additions and 3 deletions.
  1. +8 −3 plugin/yaml_flattener.vim
View
11 plugin/yaml_flattener.vim
@@ -40,9 +40,14 @@ EOF
function! s:YAMLToggleFlatness()
" If we're not in the beginning when we run this, we might get errors.
:1
- ruby yaml_toggle_flatness
- :$d
- :1
+
+ try
+ ruby yaml_toggle_flatness
+ :$d
+ :1
+ catch /SyntaxError/
+ echoerr "This YAML has a syntax error! Aborting."
+ endtry
endfunction
command! YAMLToggleFlatness call <SID>YAMLToggleFlatness()

0 comments on commit 9316641

Please sign in to comment.
Something went wrong with that request. Please try again.