Skip to content

Commit

Permalink
Add g:traces_preserve_view_state option (closes #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtal8 committed Oct 27, 2017
1 parent 3e1f2c5 commit 8832f2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/traces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ If value is 0, range for |:%| specifier will not be shown. >
<
Default value: 1

*g:traces_preserve_view_state*
If value is 1, view position will not be changed when highlighting ranges or
patterns outside initial view position.
<
Default value: 0


==============================================================================
BUGS *traces-bugs*
- \& range specifier is not supported
Expand Down
3 changes: 3 additions & 0 deletions plugin/traces.vim
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ function! s:highlight(pattern_regex, selection_regex, last_specifier_pattern, ab
silent! call s:set_cursor_position(a:pattern_regex, a:selection_regex, a:abs_range)
endif

if get(g:, 'traces_preserve_view_state')
call cursor(s:cursor_initial_pos)
endif
redraw
endfunction

Expand Down

0 comments on commit 8832f2e

Please sign in to comment.