Don't move the cursor to beginning of line on deactivating limelight (#60)

Calling functions in vim using a range with `<line1>,<line2>call ...`
makes vim move the cursor to the beginning of the line. This can cause
distraction when Limelight is used in conjunction with the insert mode
(e.g. when deactivating on `InsertLeave`).

This commit makes the `Limelight` command pass the range as parameters
to the `execute` function which removes that effect while
`Limelight`ening a range still works.
This commit is contained in:
Tobias Witt
2020-09-07 07:09:35 +02:00
committed by GitHub
parent 26e913a2e0
commit 815c612250
2 changed files with 3 additions and 3 deletions

View File

@@ -254,8 +254,8 @@ function! s:cleanup()
end
endfunction
function! limelight#execute(bang, visual, ...) range
let range = a:visual ? [a:firstline, a:lastline] : []
function! limelight#execute(bang, visual, line1, line2, ...)
let range = a:visual ? [a:line1, a:line2] : []
if a:bang
if a:0 > 0 && a:1 =~ '^!' && !s:is_on()
if len(a:1) > 1