Skip to content

Commit ce27e17

Browse files
committed
Restore cursor position after undoing \= reformat
rhysd/vim-clang-format#8 rhysd/vim-clang-format#55
1 parent 7b5001e commit ce27e17

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

_vimrc

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ noremap L g_
5959
6060
" Command wrapper that preserves the current window view.
6161
function! WithViewPreserved(command)
62+
" Manully insert an undo block that preserves the current cursor position.
63+
" https://github.com/rhysd/vim-clang-format/pull/55
64+
silent execute "noautocmd normal! ii\<esc>\"_x"
6265
let w = winsaveview()
6366
execute a:command
6467
call winrestview(w)

0 commit comments

Comments
 (0)