X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/a862795e1acf5010141939a11a33a694f6fe024e..227c2d77b48c6af0e6a2e667dfbb4412f3419005:/plugin/black.vim?ds=sidebyside 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():