fichtefoll / insertdate Goto Github PK
View Code? Open in Web Editor NEWSublime Text Plugin that provides a configurable command and popup for inserting the current date and time (with specific format)
License: MIT License
Sublime Text Plugin that provides a configurable command and popup for inserting the current date and time (with specific format)
License: MIT License
super+F5
is the system-wide shortcut to toggle VoiceOver, an accessibility tool (on Yosemite, at least).
There's no way to disable this system-wide shortcut. When I type it in SublimeText3, it doesn't even register with ST3 or InsertDate. It just opens VoiceOver, and that's it.
Also, I don't know if I'm being stupid, but it won't let me edit the default InsertDate keybindings, and there is no "User" file for me to override them with.
But I think the real problem is that these are the defaults at all, since they can't work on OS X.
Dear,
there seems to be a difficulty running InsertDate in Sublime recently - no key binding works either on KDE graphic environment in Ubuntu 22.04
Tested on two machines, having KDE as their GUI, two sublime builds, same problem:
F5 brings zero response from InsertDate. also other default keybinds for InsertDate.
Aside from that problem, the "usual" shortcuts in sublime e.g. ctrl-F for search - function normally.
Anyone having the same experiences and what is the way to inspect it further?
Thanks
System versions etc:
Machine1:
Ubuntu Studio 22.04
KDE Plasma 5.24.x
KDE framework: 5.94.x
QT: 5.15.x
Machine 2:
22.04
5.24.x
5.92.x
5.15.x
obviously subversions does not matter
both on X11
If Vintageous is not in insert mode, then call insertDate with F5 will cause a crash.
When using Vintageous with Sublime, if you're in command mode and try to insert a timestamp, sublime completely freezes and has to be force quit.
Would be cool if insertDate works in vim too.. IMO
By the way Great package. π
π
For example:
β― echo 'import time; print(time.strftime("%c %Z"))' | python
Sat Dec 12 18:41:27 2015 CST
When traveling across timezones, I should only have to change the timezone configuration in one place: my OS.
Not wanting to sound like a numpty but failing dramatically, how do you actually use the plugin?
There's nothing in the command palette, and nothing in the Tools menu. Do you have to use it as a variable?
many thanks, Jake
Lovely plugin and nice tutorial, could you please add a =day of the week= format that prints
Mon
Tue
...
I have no idea what's changed (didn't download to check for a changelog) but updates are generally not a bad thing.
OK, I feel stupid, but can you please tell me exactly how to configure a keyboard shortcut to insert the ISO date in Sublime Text 3?
I have added:
// iso date (YYYY-MM-DD) { "keys": ["ctrl+shift+f5", "ctrl+shift+d"], "command": "insert_date", "args": {"format": "%Y-%m-%d"} }
To my Default (Linux) sublime-keymap - User file, but "ctrl+shift+f5" does not do anything.
What exactly am I doing incorrectly?
Thank you,
GG
Last update was on Semtember 8th, upstream update on Semtember 9thΒ β it contains 2014g with new timezones for Russia, which will be legit on October 26th, tomorrow.
Please, update asap.
I have InsertDate installed in ST3 under Windows. It was working when I first installed it about 6 months ago. Now when I hit F5 to use the plugin nothing happens.
When I look for the User Settings (to try and reassign the hotkey) there is no entry for InsertDate under Package Settings menu. There are no entries for InsertDate under the Package Control menus either.
When I try and Remove Package to uninstall and reinstall - I get the following error:
Package Control: An error occcurred while trying to remove the installed
package file for InsertDate.
[WinError 32] The process cannot access the file because it is being used
by another process: 'C:\\Users\Username\AppData\\Roaming\Sublime Text 3\Installed Packages\\InsertDate.sublime-package'
I get this error trying to uninstall the plugin, even after a fresh start of Sublime with no projects or files open in ST.
Running ST2, Win 8.1. When trying to insert the date in the default format nothing shows up. The console displays this error:
[InsertDate]
TypeError: Parameter 'tz_out' = u'UTC' is not an instance of datetime.tzinfo
Thanks.
Hello!
There's everything in the title pretty much...
Thanks for your plugin anyway!
Matt
Hi, I am trying this string "%A, %e %b %Y %Z %H:%M:%S "
http://strfti.me/ shows me "Thursday, 13 Feb 2014 GMT 15:45:54"
Sublime 3 shows "Error parsing format string"
Is this an bug? THanks
EDIT: It seems that the '%e' argument is causing the err. It should be the day of the month, without padding.
Hi,
Working with a lot of text pieces that are stored in database and duplicated in files, I would like to follow the age of a text block.
Could you add a feature like a snippet with date that could be automaticaly updated when a keystroke or a save is triggered ?
this could be <:[27/07/2015 10:26]:> or anything...
Thank you.
When I press F5 (for prompt)
I get this on the Sublime Text 2 status bar.
[InsertDate] prompt_config
setting is invalid
here is my
insert_date.sublime-settings
{
////////////////////////////////////////////////////////////////////////////
// COPY THIS FILE TO YOUR USER SETTINGS BEFORE MODIFYING IT, OTHERWISE
// CHANGES WILL BE OVERWRITTEN WITH EVERY UPDATE!
//
// Tip: Copy the file, select "Preferences > Package Settings >
// InsertDate > Settings - User" and paste.
////////////////////////////////////////////////////////////////////////////
// This is the format that will be used when no format has been specified
// when calling the command. Also used for the "InsertDate: Default"
// command from the command palette.
// Default: '%c'
"format": "%c",
// Similar to above, this is the default timezone that will be used when
// there was no other incoming timezone specified. Because the default is
// set to 'local' it will be interpreted the timezone of your machine. As
// of now, 'local' does not support the `%Z` named timezone representation
// and it is HIGHLY RECOMMENDED to specify your local pytz timezone here.
// Default: 'local'
"tz_in": "local",
// A set of pre-defined settings that are prompted by "promt_insert_time"
// and previewed. You can modify this list in your User settings, but be
// aware that you remove all these entries when overriding "prompt_config"!
// Use "user_prompt_config" if you just want to add a few entries.
//
// `$default` is replaced by the "format" setting above, unspecified values
// remain default.
"prompt_config": [
// Default timezone and formats
{ "name": "Default"
},
{ "name": "Time",
"format": "%X"
},
{ "name": "Date",
"format": "%x"
},
// UTC, iso (standards)
{ "name": "UTC",
"tz_out": "UTC"
},
{ "name": "UTC+",
"format": "$default (UTC%z)",
"tz_out": "UTC"
},
{ "name": "iso",
"format": "iso"
},
{ "name": "UTC iso",
"format": "iso",
"tz_out": "UTC"
},
// Popular timezones
{ "name": "EST",
"tz_out": "EST"
},
{ "name": "EST+",
"format": "$default (UTC%z)",
"tz_out": "EST"
},
{ "name": "PST",
"tz_out": "PST8PDT"
},
{ "name": "PST+",
"format": "$default (UTC%z)",
"tz_out": "PST8PDT"
},
{ "name": "CET",
"tz_out": "CET"
},
{ "name": "CET+",
"format": "$default (UTC%z)",
"tz_out": "CET"
}
],
// Works similar to "prompt_config" but is added to the above list.
// Supposed to be used by you when you just want to add some entries to the
// list.
"user_prompt_config": []
}
any help if even possible would be greatly appreciated.
CTRL+F5 works fine, it adds the date in a format I specified, but well would be neat to have the whole thing working.
Hi, I'm trying to understand why only some of the showed formats are actually printing the date on the open file. My insert_date.sublime-settings file is an empty JSON.
For instance, CTRL+F5 + CTRL-d works, but CTRL+F5 + CTRL+F5 doesn't.
Even weirder, if I click F5 and press enter (I want the default format) it won't print anything, but F5 then second choice (Time) it works O_o. Same with the 4th choice (UTF8), no luck, but the 5th (UTF8+) works (and seems to be true for any TZ, works only in the "with +" variant).
I have the console open but I can't see any message related with InsertDate. Could I enable some kind of debugging feature to see what's going on?
Running Sublime Text 2 on Ubuntu 13.10
Thanks a lot
Like Insert Nums, the resulting text could be previewed.
Could also be applied to #15, once I've decided on how to implement it.
Package is installed successfully. Pressing F5 does not open window as documented.
Could you change the insert command key bind?:
{ "keys": ["f5"], "command": "insert_date_panel" }
f5
is the default bind to sort lines.
Sublime Package Control update my InsertDate plugin all the day.
I see this is a version number problem ( 1.0.1 in the package metadata and 2.0.1 in the Package Control website)
Thank you
Hi!
Thanks for a nice plugin.
I just installed it on Sublime Text 3 running on Mac OS X and when hitting F5 all I see is notice in status bar:
[InsertDate] Error parsing format string
in console I see
[InsertDate] Error parsing format string
UnknownTimeZoneError: "Parameter 'tz_out' = 'EST' is not a valid timezone name"
What to do to start using plugin?
hi there,
Love your plugin. I have modified it slightly, and thought you might like the addition.
I added the following two lines to the date_format function, just above the final return:
if format.startswith("Unix"):
return str(time.time())
(note: you'll also need the time import, but you already knew that ;)
I find this very useful for when I need a unique, short timestamp.
Thanks for your consideration!
Strack
At the moment, it is jsut an empty sting because I had troubles with it earlier (unicode issues in ST2 era).
It's been on my todo since the start, but I might as well list it here.
Today when I started Sublime, InsertDate has stopped working. The console log shows that the key strokes are generating the right calls, insert_date_panel and so on. None of them do anything: the panel never shows up, the prompt window never opens, and the ones with default formats do not insert anything.
I removed InsertDate and installed it with no change. I was getting log errors from ruby and rubytest and have disabled those, so now my python console is clean. It's just that nothing happens.
I hope you'll get this and have some advice. Thanks!
InsertDate plugin keeps the required pytz package in installed directory. Therefore that not affected on updating the system timezones. For example, my country changed transition but the plugin was not affected.
My workaround for this reason:
cp /usr/share/zoneinfo/Turkey ~/.config/sublime-text-3/Packages/pytz/all/pytz/zoneinfo/Europe/Istanbul
cp /usr/share/zoneinfo/Turkey ~/.config/sublime-text-3/Packages/pytz/all/pytz/zoneinfo/Asia/Istanbul
cp /usr/share/zoneinfo/Turkey ~/.config/sublime-text-3/Packages/pytz/all/pytz/zoneinfo/Turkey
Would it be possible for some additional functionality to insert date for tomorrow? or yesterday? or how about 10 days ago, or 10 days from now?
It seems that this package cannot be removed. Everytime when I remove it, it always remind me some error.
So, could you kindly tell me how to remove it, thank you very very much.
date format:
%y-%b-%d %H:%M
or just%b
env: Windows 7 with Russian l10n, ST 2.0.1 2217
error:Traceback (most recent call last): File ".\sublime_plugin.py", line 356, in run_ File ".\insert_date.py", line 38, in run File ".\encodings\utf_8.py", line 16, in decode UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-6: invalid data
If I replace
utf-8
withcp1251
then it works as it should.I'm not sure what way is best but here I've used this:
sys_enc = locale.getpreferredencoding() text = text.decode(sys_enc)
seems to work
It would be nice to have a command to parse the selection in a view assuming it's a date, then present the user with a panel with the output formats to which the date can be transformed.
This happened unexpectedly: our local parliament decided to change time zone; they took decision just in July, and it became legit this night; I knew about it just hour ago.
Crazy stuff.
Steps to reproduce:
"tz_in": "Asia/Novosibirsk"
Expected result
UTC+7, e.g. 14:50
Actual
UTC+6, 13:50
in my user settings I added a user_prompt_config pair:
{
"user_prompt_config" : [
{
"name" : "TnC datetime",
"format" : "%A %b %d, %Y %I:%M:%S%p %z"
}
]
}
every time I press "F5" the configuration gets loaded and adds another line for "TnC datetime" to the selection list. Am I doing something wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.