diff options
Diffstat (limited to 'plugin/scroll_next.vim')
-rw-r--r-- | plugin/scroll_next.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugin/scroll_next.vim b/plugin/scroll_next.vim new file mode 100644 index 0000000..0cb23dc --- /dev/null +++ b/plugin/scroll_next.vim @@ -0,0 +1,30 @@ +" +" scroll_next.vim: Mapping to scroll a page forward until the buffer's end, +" and then to go to the :next buffer in the argument list. +" +" Author: Tom Ryder <tom@sanctum.geek.nz> +" License: Same as Vim itself +" +if exists('g:loaded_scroll_next') || &compatible + finish +endif +if v:version < 600 + finish +endif +let g:loaded_scroll_next = 1 + +" Check visibility of last line (Vim >=7.0) or cursor presence on last line +" and flick to :next if appropriate, or just page forward with PageDown +function! s:ScrollNext() abort + if line('.') == line('$') + \ || line('w$') == line('$') + silent! next + else + execute "normal! \<PageDown>" + endif +endfunction + +" Mapping setup +nnoremap <silent> <unique> + \ <Plug>(ScrollNext) + \ :<C-U>call <SID>ScrollNext()<CR> |