diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-15 21:01:00 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-15 21:01:46 +1200 |
commit | 56166b68079f1573de93c4f134996854b4e6e75a (patch) | |
tree | 5a358ca29ce7fdbc6726b5b0a437a46ebead60f2 | |
download | vim-scroll-next-56166b68079f1573de93c4f134996854b4e6e75a.tar.gz vim-scroll-next-56166b68079f1573de93c4f134996854b4e6e75a.zip |
First versionv0.1.0
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rw-r--r-- | doc/scroll_next.txt | 35 | ||||
-rw-r--r-- | plugin/scroll_next.vim | 30 |
4 files changed, 83 insertions, 0 deletions
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/ @@ -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* + + *<Plug>(ScrollNext)* +The single normal mode mapping target is `<Plug>(ScrollNext)`. There is no +default key mapping; you should define one yourself in your |vimrc|. For +example: +> + nmap <Space> <Plug>(ScrollNext) +< +AUTHOR *scroll_next-author* + +Written and maintained by Tom Ryder <tom@sanctum.geek.nz>. + +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 <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> |