X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/a862795e1acf5010141939a11a33a694f6fe024e..d00eac9944acdafe2fb61a61c7e763c6502e89d5:/plugin/black.vim diff --git a/plugin/black.vim b/plugin/black.vim index 34f30c5..f0b55b2 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -114,7 +114,10 @@ def Black(): else: cursor = vim.current.window.cursor vim.current.buffer[:] = new_buffer_str.split('\n')[:-1] - vim.current.window.cursor = cursor + try: + vim.current.window.cursor = cursor + except vim.error: + vim.current.window.cursor = (len(vim.current.buffer), 0) print(f'Reformatted in {time.time() - start:.4f}s.') def BlackUpgrade():