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

Not all functions work on Windows #16

Open
nicksiv opened this issue Sep 19, 2022 · 2 comments
Open

Not all functions work on Windows #16

nicksiv opened this issue Sep 19, 2022 · 2 comments

Comments

@nicksiv
Copy link

nicksiv commented Sep 19, 2022

Hello,
Thank you for this wonderful and unique plugin.
On Windows, apparently all functions using the system command below, are popping up an empty command prompt and freeze.
system("date -u +'%Y%m%d%H%M%S'")[:-2] . "000"

I'm using gVim.
Any chance I'm doing something wrong? I'm reading inside the code comments something about powershell, but I think the commands are using the standard windows command prompt.

Thank you!

@creinig
Copy link
Collaborator

creinig commented Sep 19, 2022

You're not doing anything wrong. That line was just only tested on (and intended for) unix-y environments, as it runs the system's "date" utility. In the classic Windows command line this doesn't exist in that form.

It's also possible to get this timestamp via vim's built-in strftime() function - it doesn't behave 100% identically across systems, but close enough. The problem is that we need the timestamp for the UTC timezone, and vim doesn't have built-in support for that. So we need to do some custom calculations to implement it. Something like in https://github.com/dahu/vim-type-datetime/blob/master/autoload/datetime.vim, function datetime#localtime()

@nicksiv
Copy link
Author

nicksiv commented Sep 21, 2022

Thank you for your quick reply.

I tried this:
Replaced the first line of function! TiddlyWikiTime() with
let l:ts=strftime('%Y%m%d%H%M%S')[:-2].'0000'

and then I needed also to update function! tiddlywiki#GetJournalTiddlerName() return value with
return strftime('%Y%m%d%H%M%S')[:-2].'0000'

and at least the link navigation works!

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