2020-07-30 05:29:03 +02:00
|
|
|
# Link internal to a file
|
2020-08-06 04:26:05 +02:00
|
|
|
#
|
|
|
|
# See: generate_toc.vim
|
|
|
|
#
|
2020-07-30 06:45:28 +02:00
|
|
|
# See issue #666 for anchor support (then internal links)
|
2020-08-04 06:44:01 +02:00
|
|
|
# Preambule set file onces and for all {{{1
|
|
|
|
# Otherwise the bash script is freezing
|
2020-08-06 04:26:05 +02:00
|
|
|
|
|
|
|
|
2020-08-13 03:39:13 +02:00
|
|
|
### Wiki {{{1
|
|
|
|
###############
|
|
|
|
|
|
|
|
|
|
|
|
### Markdown {{{1
|
|
|
|
###############
|
2020-08-06 04:26:05 +02:00
|
|
|
|
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
Given vimwiki (a):
|
|
|
|
a
|
2020-07-30 06:45:28 +02:00
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
Execute (Set filename wiki_test.md):
|
|
|
|
file wiki_test.md
|
|
|
|
|
|
|
|
Expect (a):
|
|
|
|
a
|
|
|
|
|
2020-08-06 04:26:05 +02:00
|
|
|
|
2020-08-06 17:05:52 +02:00
|
|
|
Given vimwiki (VimwikiTOC with link and number {{{1):
|
|
|
|
[link1](#i-v-p-741528)
|
|
|
|
[link2](#i-v-p-741528-2)
|
|
|
|
|
|
|
|
# I [V p](h) (7.415.28)
|
|
|
|
|
|
|
|
# I [V p](h) 741.528
|
|
|
|
|
|
|
|
Execute (Set syntax markdown):
|
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
Do (Enter link):
|
|
|
|
gg\<Cr>
|
|
|
|
A__HERE1__\<Esc>
|
|
|
|
ggj\<Cr>
|
|
|
|
A__HERE2__\<Esc>
|
|
|
|
|
|
|
|
Expect():
|
|
|
|
[link1](#i-v-p-741528)
|
|
|
|
[link2](#i-v-p-741528-2)
|
|
|
|
|
|
|
|
# I [V p](h) (7.415.28)__HERE1__
|
|
|
|
|
|
|
|
# I [V p](h) 741.528__HERE2__
|
|
|
|
|
2020-08-06 04:26:05 +02:00
|
|
|
Given vimwiki (VimwikiTOC is broken against headers with link #182 {{{1):
|
|
|
|
[A link B](#a-link-b)
|
|
|
|
[tlink](#tlink)
|
|
|
|
[7.4.1528](#741528)
|
|
|
|
[link (333)](#link-333)
|
|
|
|
|
|
|
|
# A [link](anything here) B
|
|
|
|
|
|
|
|
# t[link](anything here)
|
|
|
|
|
|
|
|
## 7.4.1528
|
|
|
|
|
|
|
|
#### [link]() (333)
|
|
|
|
|
|
|
|
|
2020-08-06 17:05:52 +02:00
|
|
|
Execute (Set syntax markdown):
|
2020-08-06 04:26:05 +02:00
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
|
|
|
|
Do (Enter link):
|
|
|
|
gg\<Cr>
|
|
|
|
A__HERE1__\<Esc>
|
|
|
|
ggj\<Cr>
|
|
|
|
A__HERE2__\<Esc>
|
|
|
|
ggjj\<Cr>
|
|
|
|
A__HERE3__\<Esc>
|
|
|
|
ggjjj\<Cr>
|
|
|
|
A__HERE4__\<Esc>
|
2020-08-09 22:13:53 +02:00
|
|
|
:AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\<Cr>
|
|
|
|
|
2020-08-06 04:26:05 +02:00
|
|
|
|
|
|
|
Expect vimwiki (Good anchor with link navigation):
|
|
|
|
[A link B](#a-link-b)
|
|
|
|
[tlink](#tlink)
|
|
|
|
[7.4.1528](#741528)
|
|
|
|
[link (333)](#link-333)
|
|
|
|
|
|
|
|
# A [link](anything here) B__HERE1__
|
|
|
|
|
|
|
|
# t[link](anything here)__HERE2__
|
|
|
|
|
|
|
|
## 7.4.1528__HERE3__
|
|
|
|
|
|
|
|
#### [link]() (333)__HERE4__
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
# Link to anchor in SetExt {{{1
|
|
|
|
# Like that
|
|
|
|
# -----
|
|
|
|
# Issue: #209
|
|
|
|
|
|
|
|
Given vimwiki (Anchor SetExt):
|
|
|
|
[jump](#frst-one)
|
|
|
|
|
|
|
|
F!rst One
|
|
|
|
=========
|
|
|
|
|
|
|
|
Execute (Set filename wiki_test.md):
|
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
Do (Enter link):
|
|
|
|
\<Cr>
|
|
|
|
A__HERE__\<Esc>
|
|
|
|
|
|
|
|
Expect (Cursor jumped SetExt):
|
|
|
|
[jump](#frst-one)
|
2020-07-30 06:45:28 +02:00
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
F!rst One__HERE__
|
|
|
|
=========
|
|
|
|
|
|
|
|
Given vimwiki (Bad Anchor SetExt):
|
|
|
|
[jump](#frst-one)
|
|
|
|
|
|
|
|
F!rst One
|
|
|
|
|
|
|
|
Execute (Set filename wiki_test.md):
|
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
Do (Enter link):
|
|
|
|
\<Cr>
|
|
|
|
A__HERE__\<Esc>
|
|
|
|
|
|
|
|
Expect (Cursor stayed (not jumped) SetExt):
|
|
|
|
[jump](#frst-one)__HERE__
|
|
|
|
|
|
|
|
F!rst One
|
|
|
|
|
|
|
|
# Link to anchor with spaces {{{1
|
2020-07-30 06:45:28 +02:00
|
|
|
# PR #840
|
|
|
|
# Issues: #831
|
|
|
|
|
|
|
|
Given vimwiki (Internal links zith spaces):
|
|
|
|
[Any ! apparent name @#$](#basic-heading-many-spaces)
|
|
|
|
One line here
|
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
## Basic HeAding Many SpacES
|
2020-07-30 06:45:28 +02:00
|
|
|
|
|
|
|
One line here
|
|
|
|
|
2020-07-30 07:10:36 +02:00
|
|
|
Execute (Set filename wiki_test.md):
|
2020-07-30 06:45:28 +02:00
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
Do (Enter link):
|
|
|
|
\<Cr>
|
|
|
|
A__HERE__\<Esc>
|
|
|
|
|
|
|
|
Expect (Cursor at heading position):
|
|
|
|
[Any ! apparent name @#$](#basic-heading-many-spaces)
|
|
|
|
One line here
|
|
|
|
|
2020-08-04 06:44:01 +02:00
|
|
|
## Basic HeAding Many SpacES__HERE__
|
2020-07-30 06:45:28 +02:00
|
|
|
|
|
|
|
One line here
|
|
|
|
|
|
|
|
Execute (Clear wiki jumps (alias: prev_links)):
|
|
|
|
call vimwiki#vars#set_bufferlocal('prev_links', [])
|
|
|
|
|
|
|
|
|
|
|
|
# Before {{{1
|
2019-10-28 19:14:50 +01:00
|
|
|
|
|
|
|
Given vimwiki (Internal links + one link to filenew):
|
|
|
|
# Contents
|
2020-01-05 05:21:52 +01:00
|
|
|
|
2019-10-28 19:14:50 +01:00
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
2020-01-05 05:21:52 +01:00
|
|
|
|
2019-10-28 19:14:50 +01:00
|
|
|
# Test1
|
2020-01-05 05:21:52 +01:00
|
|
|
|
2019-10-28 19:14:50 +01:00
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew)
|
2020-01-05 05:21:52 +01:00
|
|
|
|
2019-10-28 19:14:50 +01:00
|
|
|
# Test2
|
2020-01-05 05:21:52 +01:00
|
|
|
|
2019-10-28 19:14:50 +01:00
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
Execute (Set filename wiki_test.md):
|
|
|
|
call SetSyntax('markdown')
|
|
|
|
|
|
|
|
Do (Navigate with <Tab>):
|
|
|
|
A more Contents\<Esc>
|
|
|
|
\<Tab>
|
|
|
|
\<Enter>
|
|
|
|
A more Test1\<Esc>
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
\<Enter>
|
|
|
|
A more Test2\<Esc>
|
|
|
|
|
|
|
|
Expect (Content added to titles):
|
|
|
|
# Contents more Contents
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
|
|
|
|
# Test1 more Test1
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
# Test2 more Test2
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
|
|
|
|
\<Tab>
|
|
|
|
\<Enter>
|
|
|
|
# Cursor at Test1
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
\<Enter>
|
|
|
|
# Cursor at Test2
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Test2/filenew
|
|
|
|
A not yet\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
A near Test1/test2
|
|
|
|
\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Contents/test1
|
|
|
|
A near Contents/test1
|
|
|
|
\<Esc>
|
|
|
|
|
|
|
|
Expect (Vimwiki links):
|
|
|
|
# Contents
|
|
|
|
|
|
|
|
- [Test1](#Test1) near Contents/test1
|
|
|
|
- [Test2](#Test2)
|
|
|
|
|
|
|
|
# Test1
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2) near Test1/test2
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
# Test2
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew) not yet
|
|
|
|
|
|
|
|
Do (Navigate with <Tab> comeback with <Bs> from filenew):
|
|
|
|
\<Tab>
|
|
|
|
A first shot\<Esc>
|
|
|
|
0\<Tab>
|
|
|
|
# Cursor at Contents/test1
|
|
|
|
\<Enter>
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
A first shot\<Esc>
|
|
|
|
0\<Tab>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
\<Enter>
|
|
|
|
G
|
|
|
|
# Cursor at Test2/filenew
|
|
|
|
A first shot\<Esc>
|
|
|
|
0\<Tab>
|
|
|
|
# Cursor at Test2/filenew
|
|
|
|
\<Enter>
|
|
|
|
# Cursor in filenew (a new file)
|
|
|
|
A anything in filenew: empirically it does not count\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test2/filenew
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Contents/test1
|
|
|
|
A second shot
|
|
|
|
|
|
|
|
Expect (Just Contents/test1 got the second shot):
|
|
|
|
# Contents
|
|
|
|
|
|
|
|
- [Test1](#Test1) first shot second shot
|
|
|
|
- [Test2](#Test2)
|
|
|
|
|
|
|
|
# Test1
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2) first shot
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
# Test2
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew) first shot
|
|
|
|
|
|
|
|
Execute (Delete filenew buffer):
|
2020-08-09 22:13:53 +02:00
|
|
|
call DeleteFile('/testplugin/filenew.md')
|
2019-10-28 19:14:50 +01:00
|
|
|
|
|
|
|
Do (Navigate with <Tab> comeback with <Bs> too far):
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Contents/test1
|
|
|
|
\<Enter>
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
\<Enter>
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Test2/test1
|
|
|
|
\<Enter>
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
\<Enter>
|
|
|
|
A first test2\<Esc>
|
|
|
|
\<Tab>
|
|
|
|
# Cursor at Test2/test1
|
|
|
|
\<Enter>
|
|
|
|
A first test1\<Esc>
|
|
|
|
# Back
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test2/test1
|
|
|
|
A second test2/test1\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
A second test1/test2\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test2/test1
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Test1/test2
|
|
|
|
\<Bs>
|
|
|
|
# Cursor at Contents/test1
|
|
|
|
# Finished
|
|
|
|
\<Bs>
|
|
|
|
\<Bs>
|
|
|
|
\<Bs>
|
|
|
|
\<Bs>
|
|
|
|
A 1\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
A 2\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
A 3\<Esc>
|
|
|
|
\<Bs>
|
|
|
|
A 4\<Esc>
|
|
|
|
|
|
|
|
Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
|
|
|
|
# Contents
|
|
|
|
|
|
|
|
- [Test1](#Test1) 1 2 3 4
|
|
|
|
- [Test2](#Test2)
|
|
|
|
|
|
|
|
# Test1 first test1
|
|
|
|
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2) second test1/test2
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
# Test2 first test2
|
|
|
|
|
|
|
|
- [Test1](#Test1) second test2/test1
|
|
|
|
- [Test2](#Test2)
|
|
|
|
- [filenew](filenew)
|
|
|
|
|
|
|
|
Given vimwiki (link to self):
|
|
|
|
- [Bad link](Very bad.html)
|
|
|
|
- [My own file](wiki_test)
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
|
|
|
|
|
|
|
Do (Follow link to self and append chars):
|
|
|
|
\<Tab>
|
|
|
|
\<Tab>
|
|
|
|
\<Enter>
|
|
|
|
a this_is_18_chars \<Esc>
|
|
|
|
|
|
|
|
Expect (Some chars appended at self link):
|
|
|
|
- [Bad link](Very bad.html)
|
|
|
|
- [ this_is_18_chars My own file](wiki_test)
|
|
|
|
- [Test1](#Test1)
|
|
|
|
- [Test2](#Test2)
|
2020-07-30 06:45:28 +02:00
|
|
|
|
|
|
|
# vim: foldmethod=marker foldlevel=30 sw=2
|