From 56166b68079f1573de93c4f134996854b4e6e75a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 15 Aug 2018 21:01:00 +1200 Subject: First version --- README.md | 17 +++++++++++++++++ VERSION | 1 + doc/scroll_next.txt | 35 +++++++++++++++++++++++++++++++++++ plugin/scroll_next.vim | 30 ++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 README.md create mode 100644 VERSION create mode 100644 doc/scroll_next.txt create mode 100644 plugin/scroll_next.vim diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2f1bc0 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +scroll\_next.vim +================ + +This plugin provides a mapping target that scrolls through the current buffer +with `PageDown` while the final line of the buffer is not visible in the +window, and `:next` to move to the next file in the argument list when it is. +It's therefore a lazy way to read several buffers in sequence while just +tapping one key. The author likes to use it for reading several buffers on +limited keyboards, such as a mobile phone terminal client. + +License +------- + +Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. +See `:help license`. + +[1]: https://sanctum.geek.nz/ diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/doc/scroll_next.txt b/doc/scroll_next.txt new file mode 100644 index 0000000..0aabaf9 --- /dev/null +++ b/doc/scroll_next.txt @@ -0,0 +1,35 @@ +*scroll_next.txt* For Vim version 6.0 Last change: 2018 Aug 15 + +DESCRIPTION *scroll_next* + +This plugin provides a mapping target that scrolls through the current buffer +with |PageDown| while the final line of the buffer is not visible in the +window, and |:next| to move to the next file in the argument list when it is. +It's therefore a lazy way to read several buffers in sequence while just +tapping one key. The author likes to use it for reading several buffers on +limited keyboards, such as a mobile phone terminal client. + +REQUIREMENTS *scroll_next-requirements* + +This plugin only loads if 'compatible' is not set. It works on |version6| and +newer. If you have |version7| then you don't have to hit the last line of the +buffer; it just has to be visible in the window. + +MAPPINGS *scroll_next-mappings* + + *(ScrollNext)* +The single normal mode mapping target is `(ScrollNext)`. There is no +default key mapping; you should define one yourself in your |vimrc|. For +example: +> + nmap (ScrollNext) +< +AUTHOR *scroll_next-author* + +Written and maintained by Tom Ryder . + +LICENSE *scroll_next-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + + vim:tw=78:ts=8:ft=help:norl: 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 +" 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! \" + endif +endfunction + +" Mapping setup +nnoremap + \ (ScrollNext) + \ :call ScrollNext() -- cgit v1.2.3