Create function for updating lines
This commit is contained in:
parent
81e889f909
commit
1c1130bfe4
@ -140,6 +140,17 @@
|
|||||||
call setbufvar(bufname(0), a:var, new_value)
|
call setbufvar(bufname(0), a:var, new_value)
|
||||||
endif
|
endif
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
function! s:SetLines(lines, key) " {{{
|
||||||
|
for [line_num, line] in a:lines
|
||||||
|
try
|
||||||
|
" Try to join changes with previous undo block
|
||||||
|
undojoin
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
|
||||||
|
call setline(line_num, line[a:key])
|
||||||
|
endfor
|
||||||
|
endfunction " }}}
|
||||||
" }}}
|
" }}}
|
||||||
" Core functions {{{
|
" Core functions {{{
|
||||||
function! s:PromptUser(groups) "{{{
|
function! s:PromptUser(groups) "{{{
|
||||||
@ -191,14 +202,7 @@
|
|||||||
let target_hl_id = matchadd(g:EasyMotion_target_hl, join(hl_coords, '\|'), 1)
|
let target_hl_id = matchadd(g:EasyMotion_target_hl, join(hl_coords, '\|'), 1)
|
||||||
|
|
||||||
" Set lines with markers
|
" Set lines with markers
|
||||||
for [line_num, line] in lines_items
|
call <SID>SetLines(lines_items, 'marker')
|
||||||
try
|
|
||||||
undojoin
|
|
||||||
catch
|
|
||||||
endtry
|
|
||||||
|
|
||||||
call setline(line_num, line['marker'])
|
|
||||||
endfor
|
|
||||||
|
|
||||||
redraw
|
redraw
|
||||||
|
|
||||||
@ -214,14 +218,7 @@
|
|||||||
redraw
|
redraw
|
||||||
finally
|
finally
|
||||||
" Restore original lines
|
" Restore original lines
|
||||||
for [line_num, line] in lines_items
|
call <SID>SetLines(lines_items, 'orig')
|
||||||
try
|
|
||||||
undojoin
|
|
||||||
catch
|
|
||||||
endtry
|
|
||||||
|
|
||||||
call setline(line_num, line['orig'])
|
|
||||||
endfor
|
|
||||||
|
|
||||||
call matchdelete(target_hl_id)
|
call matchdelete(target_hl_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user