diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 17:50:23 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 17:50:23 +1200 |
commit | 40be59707a2f093f59e9a664a4267d9982dc4b2e (patch) | |
tree | 556f69f24725304c6af6d0037a8e53f9b9ba80a8 | |
parent | Add exclamation mark to function declarations (diff) | |
download | vim-strip-trailing-whitespace-40be59707a2f093f59e9a664a4267d9982dc4b2e.tar.gz vim-strip-trailing-whitespace-40be59707a2f093f59e9a664a4267d9982dc4b2e.zip |
Simplify cursor restoration
-rw-r--r-- | autoload/strip_trailing_whitespace.vim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/autoload/strip_trailing_whitespace.vim b/autoload/strip_trailing_whitespace.vim index 14a2e2d..681016e 100644 --- a/autoload/strip_trailing_whitespace.vim +++ b/autoload/strip_trailing_whitespace.vim @@ -3,8 +3,7 @@ function! strip_trailing_whitespace#Strip(start, end) abort " Save cursor position - let line = line('.') - let col = col('.') + let pos = getpos('.') " Whether we made changes let changed = 0 @@ -21,7 +20,7 @@ function! strip_trailing_whitespace#Strip(start, end) abort let changed = changed || horizontal > 0 " Return the cursor - call cursor(line, col) + call setpos('.', pos) " Report what changed let msg = horizontal.' trimmed' |