Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No File extension when new zettel is created from outside a Wiki #141

Open
uwolf opened this issue Dec 17, 2023 · 3 comments
Open

No File extension when new zettel is created from outside a Wiki #141

uwolf opened this issue Dec 17, 2023 · 3 comments

Comments

@uwolf
Copy link

uwolf commented Dec 17, 2023

When ZettelNew is called from outside a wiki, the note file is created without a file extension, at least in my very basic setup:

let g:vimwiki_list = [{'path': '~/vimwiki/',  'syntax': 'markdown', 'ext': 'md'}]
let g:vimwiki_global_ext = 0
let g:zettel_options = [ {"rel_path" : "zettel/" } ]

I don't know much about vimscript, so no pull request, but for a quick fix, I added the file extension from the wiki config in
autoload/zettel/vimwiki.vim in function zettel#vimwiki#create

567     let zettelpath = zettel#vimwiki#path(a:wiki_nr)
568     " add extension 
569     let ext = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
570     execute(':e ' . zettelpath . format . ext)

@michal-h21
Copy link
Owner

Thanks for the report and for the proposed fix. It seems to work. I've modified it a bit, as the wiki_nr should be passed to zettel#vimwiki#create as a parameter.

@uwolf
Copy link
Author

uwolf commented Dec 18, 2023

Thanks you. There is still an Issue with ZettelGenerateLinks though. It generates Links to the main wiki dir, not the rel_path. So whenever i click those links, it opens empty files, not the notes. But did not have the time to dig deeper into the code yet. I think this plugin is much more usefull, when ZettelNew can be called whereever you are.

@michal-h21
Copy link
Owner

Relative paths are painful in general. The support for them is a work in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants