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