Jordan Savant // Software Engineer

" DEFINE THE FUNCTION
" Presition Buffer Locator -- START
highlight PresitionHighlight ctermfg=118
sign define PresitionSign text=| texthl=PresitionHighlight
:let g:presid=2
function! Presition()
    let topLine=str2float(line("w0"))
    let currentLine=str2float(line("."))
    let bottomLine=str2float(line("w$"))
    let totalLines=str2float(line("$"))
    let height=(bottomLine - topLine)
    let spot=(currentLine * (height / totalLines))
    let round = float2nr(spot + topLine)
    let g:presid=g:presid+1
    exec "sign place " . g:presid . " line=" . round . " name=PresitionSign file=" . expand("%:p")
    exec "sign unplace " . (g:presid - 1)
endfunction
:command -nargs=0 Presition :call Presition()

" APPLY FUNCTION AT EVENTS:
if ! &diff && bufname("%") != '.git/COMMIT_EDITMSG'
    autocmd CursorMoved * Presition
    autocmd CursorMovedI * Presition
endif

" IN A FILE INITIALIZATION:
" Always have a sign to stop window size flicker
exec "sign place 1 line=999999 name=PresitionSign buffer=" . bufnr("%")