Revert "Update the links when renaming markdown wikis"
This reverts commit 599a0e9083
.
Sorry, we can't simply change the syntax of something as basic as a
link, even if the old syntax is wrong. We need to keep Vimwiki
reasonably backwards compatible.
This commit is contained in:
parent
2346b7e299
commit
65b0c97c6d
@ -1340,22 +1340,11 @@ function! vimwiki#base#rename_link()
|
||||
execute ':update'
|
||||
endfor
|
||||
|
||||
" activate the renamed buffer
|
||||
execute ':b '.escape(cur_buffer[0], ' ')
|
||||
|
||||
" rename the buffer name to the new name
|
||||
" execute ':file '.new_link
|
||||
|
||||
" leave the renamed buffer and remove the rest wiki buffers
|
||||
" the reason we leave the renamed buffer is because the get_wikilocal
|
||||
" function use the current file name to get the vars of current file's
|
||||
" wiki, but after calling rename function, %:p still returns empty
|
||||
" rather than the new full file path, so we just leave the renamed file's
|
||||
" buffer so that %:p would be the renamed full file path
|
||||
" remove wiki buffers
|
||||
for bitem in blist
|
||||
if !vimwiki#path#is_equal(bitem[0], cur_buffer[0])
|
||||
execute 'bwipeout '.escape(bitem[0], ' ')
|
||||
endif
|
||||
endfor
|
||||
|
||||
let setting_more = &more
|
||||
@ -1364,12 +1353,6 @@ function! vimwiki#base#rename_link()
|
||||
" update links
|
||||
call s:update_wiki_links(wiki_nr, s:tail_name(old_fname), s:tail_name(new_link),old_fname)
|
||||
|
||||
" remove current buffer and reopen it after restoring all
|
||||
" buffers to put it at the end of all buffers, vim does not
|
||||
" support reorder the buffers so need to reopen it to put
|
||||
" it at the end
|
||||
execute 'bwipeout '.escape(cur_buffer[0], ' ')
|
||||
|
||||
" restore wiki buffers
|
||||
for bitem in blist
|
||||
if !vimwiki#path#is_equal(bitem[0], cur_buffer[0])
|
||||
@ -1378,6 +1361,7 @@ function! vimwiki#base#rename_link()
|
||||
endfor
|
||||
|
||||
call s:open_wiki_buffer([new_fname, cur_buffer[1]])
|
||||
" execute 'bwipeout '.escape(cur_buffer[0], ' ')
|
||||
|
||||
echomsg 'Vimwiki: '.old_fname.' is renamed to '.new_fname
|
||||
|
||||
|
@ -500,8 +500,8 @@ function! s:populate_extra_markdown_vars()
|
||||
let mkd_syntax.rxWikiLink0MatchDescr = mkd_syntax.rxWikiLinkMatchDescr
|
||||
|
||||
let wikilink_md_prefix = '['
|
||||
let wikilink_md_separator = ']('
|
||||
let wikilink_md_suffix = ')'
|
||||
let wikilink_md_suffix = ']'
|
||||
let wikilink_md_separator = ']['
|
||||
let rx_wikilink_md_separator = vimwiki#u#escape(wikilink_md_separator)
|
||||
let mkd_syntax.rx_wikilink_md_prefix = vimwiki#u#escape(wikilink_md_prefix)
|
||||
let mkd_syntax.rx_wikilink_md_suffix = vimwiki#u#escape(wikilink_md_suffix)
|
||||
@ -535,21 +535,21 @@ function! s:populate_extra_markdown_vars()
|
||||
let mkd_syntax.rx_wikilink_md_suffix = mkd_syntax.rx_wikilink_md_suffix.
|
||||
\ mkd_syntax.rxWikiLink1InvalidSuffix
|
||||
|
||||
" 1. match [URL][], [DESCRIPTION](URL)
|
||||
" 1. match [URL][], [DESCRIPTION][URL]
|
||||
let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix.
|
||||
\ mkd_syntax.rxWikiLink1Url. rx_wikilink_md_separator.
|
||||
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||
\ mkd_syntax.rxWikiLink1Descr . rx_wikilink_md_separator.
|
||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||
" 2. match URL within [URL][], [DESCRIPTION](URL)
|
||||
" 2. match URL within [URL][], [DESCRIPTION][URL]
|
||||
let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix.
|
||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. rx_wikilink_md_separator.
|
||||
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||
\ mkd_syntax.rxWikiLink1Descr. rx_wikilink_md_separator.
|
||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix
|
||||
" 3. match DESCRIPTION within [DESCRIPTION](URL)
|
||||
" 3. match DESCRIPTION within [DESCRIPTION][URL]
|
||||
let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix.
|
||||
\ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. rx_wikilink_md_separator.
|
||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||
|
Loading…
Reference in New Issue
Block a user