mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Fixed: fix a bug in markdown_insert_url. (#2620)
* Fixed: fix a bug in markdown_insert_url. * Fix: fix a bug when the '< and '> in two different lines.
This commit is contained in:
parent
8974e91873
commit
efc9d28cf2
@ -103,18 +103,24 @@ endfunction
|
|||||||
function! s:markdown_insert_url(visual) abort
|
function! s:markdown_insert_url(visual) abort
|
||||||
if !empty(@+)
|
if !empty(@+)
|
||||||
let l:save_register_unnamed = @"
|
let l:save_register_unnamed = @"
|
||||||
if a:visual
|
let l:save_edge_left = getpos("'<")
|
||||||
normal! gvx
|
let l:save_edge_right = getpos("'>")
|
||||||
else
|
if !a:visual
|
||||||
normal! diw
|
execute "normal! viw\<esc>"
|
||||||
endif
|
endif
|
||||||
|
let l:paste = (col("'>") == col("$") - 1 ? 'p' : 'P')
|
||||||
|
normal! gvx
|
||||||
let @" = '[' . @" . '](' . @+ . ')'
|
let @" = '[' . @" . '](' . @+ . ')'
|
||||||
if col('.') == col('$') - 1
|
execute 'normal! ' . l:paste
|
||||||
normal! p
|
|
||||||
else
|
|
||||||
normal! P
|
|
||||||
endif
|
|
||||||
let @" = l:save_register_unnamed
|
let @" = l:save_register_unnamed
|
||||||
|
if a:visual
|
||||||
|
let l:save_edge_left[2] += 1
|
||||||
|
if l:save_edge_left[1] == l:save_edge_right[1]
|
||||||
|
let l:save_edge_right[2] += 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
call setpos("'<", l:save_edge_left)
|
||||||
|
call setpos("'>", l:save_edge_right)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user