formatting now doesn't mess with cursor position
This commit is contained in:
parent
46b7b8db45
commit
dd7b0fd2a5
|
@ -1,16 +1,18 @@
|
|||
setlocal commentstring=//\ %s
|
||||
|
||||
function Hbformat()
|
||||
function HBformat()
|
||||
silent! !hbc --fmt-stdout <afile>
|
||||
if v:shell_error
|
||||
echom "Errors in file"
|
||||
!hbc --fmt-stdout <afile>
|
||||
else
|
||||
let save_cursor = getcurpos()
|
||||
silent! %!hbc --fmt-stdout <afile>
|
||||
call setpos('.', save_cursor)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup hblang_group
|
||||
autocmd!
|
||||
autocmd BufWritePost *.hb :call Hbformat()
|
||||
autocmd BufWritePost *.hb :call HBformat()
|
||||
augroup END
|
||||
|
|
Loading…
Reference in a new issue