diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-29 02:11:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-29 02:11:44 +1200 |
commit | d468ed5edc51e1fde19c82c91646ce76eec8bcbb (patch) | |
tree | 5e612bf445a36d5593eba814683bc17e57ad4c32 | |
parent | Merge branch 'release/v1.0.0' into develop (diff) | |
download | vim-scroll-next-d468ed5edc51e1fde19c82c91646ce76eec8bcbb.tar.gz vim-scroll-next-d468ed5edc51e1fde19c82c91646ce76eec8bcbb.zip |
Reduce to just one expression
-rw-r--r-- | autoload/scroll_next.vim | 9 | ||||
-rw-r--r-- | plugin/scroll_next.vim | 7 |
2 files changed, 3 insertions, 13 deletions
diff --git a/autoload/scroll_next.vim b/autoload/scroll_next.vim deleted file mode 100644 index cb40a18..0000000 --- a/autoload/scroll_next.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Check visibility of last line and flick to :next if appropriate, or just -" page forward with PageDown -function! scroll_next#ScrollNext() abort - if line('w$') == line('$') - return ":\<C-U>next\<CR>" - else - return "\<PageDown>" - endif -endfunction diff --git a/plugin/scroll_next.vim b/plugin/scroll_next.vim index ae3f269..f9e19bf 100644 --- a/plugin/scroll_next.vim +++ b/plugin/scroll_next.vim @@ -10,7 +10,6 @@ if exists('loaded_scroll_next') || &compatible || v:version < 700 endif let loaded_scroll_next = 1 -" Mapping setup -nnoremap <expr> <silent> <unique> - \ <Plug>(ScrollNext) - \ scroll_next#ScrollNext() +" If last line visible, go to next file, otherwise page down +nnoremap <expr> <Plug>(ScrollNext) + \ line('w$') == line('$') ? ":\<C-U>next\<CR>" : "\<PageDown>" |