Skip to main content
added 137 characters in body
Source Link
alec
  • 835
  • 7
  • 22

I'm using VimWiki for a writing project and for certain sections (like "chapters", contained in sub-directories) I want to create indexes that work similarly to the way VimWiki's diary index works. Unfortunately in reading through the plugin's source I haven't been able to understand how the VimwikiDiaryGenerateLinks function works in order to replicate it for something similar.

My exact goal is this:
In my vimwiki section index page I want to automatically create links to files that match a pattern...

for all files like:

~/Documents/wiki/subdir1/string_xyz123.mkd
~/Documents/wiki/subdir1/string_xyz456.mkd
~/Documents/wiki/subdir1/string_xyz789.mkd

I want to create a list of links in vimwiki markdown like this:

- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Sometimes I'll create new string_xyz789.mkd pages like that from someplace other than thethis index file, so I want this index file to keep itself updated automatically, the (the way VimWiki's "diary" index file automatically lists all the diary entries that exist).

In addition to the automatically generated list of links, thisThe index page as a whole will have text that's manually entered by editing that file, so it's important that the solution does not delete/alter the paragraphs etc that are entered manuallybe structured somewhat like this:

# Page Title

Some various content... perhaps multiple paragraphs...

## Automatically generated list of links
- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Other content that I type manually.

. The..and only the auto-generated list of links should probably be prefaced with ### Section Index so the script knows what section ofupdated. I need to be able to type content before and after the list as if I'm just editing a normal wiki page to update.

Does VimWiki provide a solution for this?

If not could you suggest how to approach scripting this myself?

I'm using VimWiki for a writing project and for certain sections (like "chapters", contained in sub-directories) I want to create indexes that work similarly to the way VimWiki's diary index works. Unfortunately in reading through the plugin's source I haven't been able to understand how the VimwikiDiaryGenerateLinks function works in order to replicate it for something similar.

My exact goal is this:
In my vimwiki section index page I want to automatically create links to files that match a pattern...

for all files like:

~/Documents/wiki/subdir1/string_xyz123.mkd
~/Documents/wiki/subdir1/string_xyz456.mkd
~/Documents/wiki/subdir1/string_xyz789.mkd

I want to create a list of links in vimwiki markdown like this:

- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Sometimes I'll create new pages like that from someplace other than the index file, so I want this index file to keep itself updated automatically, the way VimWiki's "diary" index file automatically lists all the diary entries that exist.

In addition to the automatically generated list of links, this index page will have text that's manually entered by editing that file, so it's important that the solution does not delete/alter the paragraphs etc that are entered manually. The list of links should probably be prefaced with ### Section Index so the script knows what section of the page to update.

Does VimWiki provide a solution for this?

If not could you suggest how to approach scripting this myself?

I'm using VimWiki for a writing project and for certain sections (like "chapters", contained in sub-directories) I want to create indexes that work similarly to the way VimWiki's diary index works. Unfortunately in reading through the plugin's source I haven't been able to understand how the VimwikiDiaryGenerateLinks function works in order to replicate it for something similar.

My exact goal is this:
In my vimwiki section index page I want to automatically create links to files that match a pattern...

for all files like:

~/Documents/wiki/subdir1/string_xyz123.mkd
~/Documents/wiki/subdir1/string_xyz456.mkd
~/Documents/wiki/subdir1/string_xyz789.mkd

I want to create a list of links in vimwiki markdown like this:

- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Sometimes I'll create new string_xyz789.mkd pages from someplace other than this index file, so I want this index file to keep itself updated automatically (the way VimWiki's "diary" index file automatically lists all the diary entries that exist).

The index page as a whole will be structured somewhat like this:

# Page Title

Some various content... perhaps multiple paragraphs...

## Automatically generated list of links
- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Other content that I type manually.

...and only the auto-generated list of links should be updated. I need to be able to type content before and after the list as if I'm just editing a normal wiki page.

Does VimWiki provide a solution for this?

If not could you suggest how to approach scripting this myself?

Source Link
alec
  • 835
  • 7
  • 22

VimWiki - create a "smart" index page for subdir/section of wiki?

I'm using VimWiki for a writing project and for certain sections (like "chapters", contained in sub-directories) I want to create indexes that work similarly to the way VimWiki's diary index works. Unfortunately in reading through the plugin's source I haven't been able to understand how the VimwikiDiaryGenerateLinks function works in order to replicate it for something similar.

My exact goal is this:
In my vimwiki section index page I want to automatically create links to files that match a pattern...

for all files like:

~/Documents/wiki/subdir1/string_xyz123.mkd
~/Documents/wiki/subdir1/string_xyz456.mkd
~/Documents/wiki/subdir1/string_xyz789.mkd

I want to create a list of links in vimwiki markdown like this:

- [xyz123](string_xyz123.mkd)
- [xyz456](string_xyz456.mkd)
- [xyz789](string_xyz789.mkd)

Sometimes I'll create new pages like that from someplace other than the index file, so I want this index file to keep itself updated automatically, the way VimWiki's "diary" index file automatically lists all the diary entries that exist.

In addition to the automatically generated list of links, this index page will have text that's manually entered by editing that file, so it's important that the solution does not delete/alter the paragraphs etc that are entered manually. The list of links should probably be prefaced with ### Section Index so the script knows what section of the page to update.

Does VimWiki provide a solution for this?

If not could you suggest how to approach scripting this myself?