lervag / wiki.vim

A wiki plugin for Vim
MIT License
654 stars 69 forks source link

Journal file is not created using +WikiJournal #228

Closed pmatulis closed 2 years ago

pmatulis commented 2 years ago

The current day's journal file is not created when using +WikiJournal.

For example, with the alacritty terminal emulator:

alacritty -e vim +WikiJournal

If I use the vim command while currently in a buffer then it works:

:WikiJournal

The file gets created.

This is my configuration in ~/.vimrc:

let g:wiki_root = '~/data/sync/wiki'
let g:wiki_filetypes = ['md']
let g:wiki_link_extension = '.md'
let g:wiki_link_target_type = 'md'
let g:wiki_global_load = 0
let g:wiki_index_name = 'index.md'
lervag commented 2 years ago

Does vim +WikiJournal work from the terminal?

lervag commented 2 years ago

You don't need to change g:wiki_index_name. It should only be the basename of the index file, and the default is already "index". See :help g:wiki_index_name:

*g:wiki_index_name*
  A string with the index page name for the wiki. The value should not include
  the file extension.

  Default: `'index'`
pmatulis commented 2 years ago

No, vim +WikiJournal does not work.

You don't need to change g:wiki_index_name.

Ok, thanks. And should vim +WikiIndex also create the index file? It doesn't.

lervag commented 2 years ago

Ok, this helps already. Can you test with a minimal example configuration? E.g., something like this; call it test.vim:

set nocompatible
set runtimepath^=~/.local/plugged/wiki.vim
filetype plugin indent on
syntax enable

let g:wiki_root = '~/data/sync/wiki'
let g:wiki_filetypes = ['md']
let g:wiki_link_extension = '.md'
let g:wiki_link_target_type = 'md'
" let g:wiki_global_load = 0

Change the path to the correct path on your system. Then run vim -u test.vim, and you should have a minimal configuration in which wiki.vim should work. With a similar file, I can do vim -u test.vim +WikiIndex and vim -u test.vim +WikiJournal, and both work as expected on my side.

pmatulis commented 2 years ago

I used your approach to learn that the vim-startify plugin is interfering. I moved it out of the way and both the index and the journal files get created as expected. Is this a complete blocker? I use startify quite a bit.

pmatulis commented 2 years ago

Okay, this does it:

vim --cmd 'let g:startify_disable_at_vimenter = 1' +WikiIndex
vim --cmd 'let g:startify_disable_at_vimenter = 1' +WikiJournal

This is worthy to document.

lervag commented 2 years ago

I'm happy to hear you figured it out! I'm not sure I agree that this should be documented for wiki.vim, though. But say we do add something: where do you think it should be added for it to be discoverable for anyone who might have a similar issue?

pmatulis commented 2 years ago

I suggest the README.

lervag commented 2 years ago

Ok, thanks. But sorry, I won't add this type of content there. In my opinion, this is really a "bug" or "issue" caused by vim-startify. I notice that this is already documented there:

https://github.com/mhinz/vim-startify/blob/master/doc/startify.txt#L1027-L1037

Further, I notice that Vimwiki, which is clearly a much more common and popular plugin than wiki.vim (but not necessarily better), does not mention startify either.