Skip to content

Commit

Permalink
Merge pull request bogado#2 from patricknraanes/master
Browse files Browse the repository at this point in the history
Flashing crosshairs on cursor{line,col}
  • Loading branch information
lervag authored Jun 26, 2020
2 parents 79e27aa + c00080f commit f885f5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ With this little script in your plugins folder if the stuff after the colon is
a number and a file exists with the name specified before the colon vim will
open this file and take you to the line you wished in the first place.

Use this setting to disable the temporary flashing crosshairs on the cursor-line/column:

let g:file_line_crosshairs=0

## License

This script is licensed with GPLv3.
Expand Down
16 changes: 16 additions & 0 deletions plugin/file_line.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ function! s:goto_file_line(...)
normal! zv
normal! zz
filetype detect
call s:crosshair_flash(3)
endif

return fname
endfunction


" Flash crosshairs (reticle) on current cursor line/column to highlight it.
" Particularly useful when the cursor is at head/tail end of file,
" in which case it will not get centered.
" Ref1: https://vi.stackexchange.com/a/3481/29697
" Ref2: https://stackoverflow.com/a/33775128/38281
let g:file_line_crosshairs = get(g:, 'file_line_crosshairs', 1)
function! s:crosshair_flash(n) abort
if g:file_line_crosshairs
for i in range(1,a:n)
set cul cuc | redraw | sleep 200m | set nocul nocuc | redraw | sleep 200m
endfor
endif
endfunction

0 comments on commit f885f5a

Please sign in to comment.