diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-03 09:25:53 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-03 09:25:53 +1200 |
commit | 71ced1ccfa28a4dffe126b1408849676e4b36505 (patch) | |
tree | 73f184a6c4b81dbf6551fddc84810eb86dc4b86c /vim/plugin/scroll_next.vim | |
parent | Merge branch 'hotfix/v1.41.1' (diff) | |
parent | Rebuild dotfiles(7) man page (diff) | |
download | dotfiles-a8fd267faf6fa84cfbc9e9e8a1650bcada079192.tar.gz (sig) dotfiles-a8fd267faf6fa84cfbc9e9e8a1650bcada079192.zip |
Merge branch 'release/v1.42.0'v1.42.0
* release/v1.42.0:
Rebuild dotfiles(7) man page
Bump VERSION
Remove unsupported pandoc(1) option
Remove j/gj,k/gk maps again
Revert "Remove & remaps"
Add some experimental :vimgrep and :helpgrep maps
Use g_ instead of $ for yanking command lines
Correct \: mapping
Round out execution mappings
Use \! instead of \@ for line-execute
Add 'confirm'
Add \@ mapping to execute lines with 'shell'
Revert "Remove j/gj remappings"
Add leader mappings for < and >
Check for existence of +completeopt
Add longest and menuone to 'completeopt'
Add equalalways_resized.vim plugin
Remove trailing space from Vim plugin
Add missing abort attribute to plugin
Add scroll_next.vim plugin
Don't set up 'wildignore' in &compatible mode
Add foldlevelstart_stdin.vim plugin
Correct syntax of new map
Try an expanded mapping for <Space>
Remove backspace mapping
Update insert_cancel.vim plugin
Diffstat (limited to 'vim/plugin/scroll_next.vim')
-rw-r--r-- | vim/plugin/scroll_next.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vim/plugin/scroll_next.vim b/vim/plugin/scroll_next.vim new file mode 100644 index 00000000..a02a4e4f --- /dev/null +++ b/vim/plugin/scroll_next.vim @@ -0,0 +1,32 @@ +" +" scroll_next.vim: Mapping to scroll a page forward with CTRL-F until the last +" line is visible in the buffer (if supported) or the cursor is on the last +" line, and to run :next instead if so to move 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 CTRL-F +function! s:ScrollNext() abort + if line('.') == line('$') + \ || line('w$') == line('$') + silent! next + else + execute "normal! \<C-F>" + endif +endfunction + +" Mapping setup +nnoremap <silent> <unique> + \ <Plug>(ScrollNext) + \ :<C-U>call <SID>ScrollNext()<CR> |