Allow any visual mode to be used to create a link
The only real condition we care about is whether the selection is contained within a single line. It is practical to do something like V<CR> to link a whole line, and AFAIK there is no reason for why that doesn't work.
This commit is contained in:
parent
3f8bb1261f
commit
1176f60ec6
@ -1986,7 +1986,7 @@ function! s:normalize_link_syntax_v()
|
||||
endif
|
||||
|
||||
" Put substitution in register " and change text
|
||||
call setreg('"', sub, 'v')
|
||||
call setreg('"', substitute(sub, '\n', '', ''), visualmode())
|
||||
normal! `>""pgvd
|
||||
finally
|
||||
call setreg('"', default_register_save, registertype_save)
|
||||
@ -2002,8 +2002,8 @@ function! vimwiki#base#normalize_link(is_visual_mode)
|
||||
else
|
||||
if !a:is_visual_mode
|
||||
call s:normalize_link_syntax_n()
|
||||
elseif visualmode() ==# 'v' && line("'<") == line("'>")
|
||||
" action undefined for 'line-wise' or 'multi-line' visual mode selections
|
||||
elseif line("'<") == line("'>")
|
||||
" action undefined for multi-line visual mode selections
|
||||
call s:normalize_link_syntax_v()
|
||||
endif
|
||||
endif
|
||||
|
@ -122,7 +122,7 @@ function! s:normalize_link_syntax_v()
|
||||
\ '__LinkUrl__', visual_selection, '')
|
||||
let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '')
|
||||
|
||||
call setreg('"', link, 'v')
|
||||
call setreg('"', substitute(link, '\n', '', ''), visualmode())
|
||||
|
||||
" paste result
|
||||
norm! `>""pgvd
|
||||
@ -141,8 +141,8 @@ function! vimwiki#markdown_base#normalize_link(is_visual_mode)
|
||||
else
|
||||
if !a:is_visual_mode
|
||||
call s:normalize_link_syntax_n()
|
||||
elseif visualmode() ==# 'v' && line("'<") == line("'>")
|
||||
" action undefined for 'line-wise' or 'multi-line' visual mode selections
|
||||
elseif line("'<") == line("'>")
|
||||
" action undefined for multi-line visual mode selections
|
||||
call s:normalize_link_syntax_v()
|
||||
endif
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user