Skip to content

Instantly share code, notes, and snippets.

@baruchel
Created March 14, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baruchel/5a53ca2ccea16724a243 to your computer and use it in GitHub Desktop.
Save baruchel/5a53ca2ccea16724a243 to your computer and use it in GitHub Desktop.
" quickmove.vim : move the cursor according to the more/less game
" Author: Thomas Baruchel
" Version: 1.0
" Date: Mar 14, 2015
"
let g:quickmove_version = "1.0"
if &compatible
finish
endif
if exists('loaded_quickmove') || &cp
finish
endif
let loaded_quickmove=1
function! QuickMoveRefresh()
if !exists('b:quickmove_current')
return 1
endif
if b:quickmove_current != getpos('.')
return 1
endif
return 0
endfunction
function! QuickMoveUp()
if QuickMoveRefresh() == 1
let b:quickmove_a=1
let b:quickmove_b=line('$')
endif
let b:quickmove_b=line('.')
exe 'silent normal! ' . (b:quickmove_a+b:quickmove_b)/2 . 'G'
let b:quickmove_current=getpos('.')
endfunction
function! QuickMoveDown()
if QuickMoveRefresh() == 1
let b:quickmove_a=1
let b:quickmove_b=line('$')
endif
let b:quickmove_a=line('.')
exe 'silent normal! ' . (b:quickmove_a+b:quickmove_b)/2 . 'G'
let b:quickmove_current=getpos('.')
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment