From 4eb142f620c6e4bf9ecb59401fae110084508775 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 28 May 2019 22:11:42 +1200 Subject: Refactor as expression mapping This makes any errors from :next work in a more natural way. --- autoload/scroll_next.vim | 4 ++-- plugin/scroll_next.vim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/scroll_next.vim b/autoload/scroll_next.vim index 8758208..cb40a18 100644 --- a/autoload/scroll_next.vim +++ b/autoload/scroll_next.vim @@ -2,8 +2,8 @@ " page forward with PageDown function! scroll_next#ScrollNext() abort if line('w$') == line('$') - silent! next + return ":\next\" else - execute "normal! \" + return "\" endif endfunction diff --git a/plugin/scroll_next.vim b/plugin/scroll_next.vim index 4535223..ae3f269 100644 --- a/plugin/scroll_next.vim +++ b/plugin/scroll_next.vim @@ -11,6 +11,6 @@ endif let loaded_scroll_next = 1 " Mapping setup -nnoremap +nnoremap \ (ScrollNext) - \ :call scroll_next#ScrollNext() + \ scroll_next#ScrollNext() -- cgit v1.2.3