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

Error when used for the first time #1

Open
Bivectorfoil opened this issue Feb 27, 2018 · 1 comment
Open

Error when used for the first time #1

Bivectorfoil opened this issue Feb 27, 2018 · 1 comment

Comments

@Bivectorfoil
Copy link

When first used, If the directory <~/logbook> does not exist, in other words, the logbook directory has not been created, "Can't write to file" error will be reported when using command :Lb.

I suggest to add a conditional judgment in the vim-logbook/autoload/logbook.vim file, like this:

if !isdirectory($HOME . "/logbook")
    call mkdir($HOME . "/logbook", "p")
    let logfile = $HOME . "/logbook/" . strftime("%F") . ".md"
    execute "edit " . logfile
else
    let logfile = $HOME . "/logbook/" . strftime("%F") . ".md"
    execute "edit " . logfile
endif

I am a newbie in vimscript, the suggestions above may seem stupid, looking forward to your improvement: )

@Newexplorer
Copy link

I have the same problem. "~/logbook/2018-03015.md" E212: Can't open file for writing.

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