9

Note: I'm interested in knowing if there's a shortcut native to gedit itself. I'm not interested in solutions involving Autokey, etc.

In gedit 3.28.1 (Ubuntu 18.04) and 3.30.0 (Ubuntu 19.04), if I want to insert the date and time (assuming the corresponding plugin is active), I need to

  1. Click on Menu (☰)
  2. Click on Tools
  3. Click on Insert Date and Time …
  4. Click on Insert

This page doesn't list a keyboard shortcut even to get directly to step #3 in the list above.

(I know there are other ways such as using xdotool and xsel to insert time and date.)

DK Bose
  • 44,553

2 Answers2

9

In Gedit click the cog-wheel and choose Preferences

Open the Plugin-tab and enable External Tools.

Close the Preferences-window and click the cog-wheel again, you will find the option Manage External Tools... now, select it to open the Manage External Tools-window:

enter image description here

Click the + button to add a new function and give it a name, add the date-command with the options of your choice, click the Shortcut key-button and assgin a shortcut and in the Output-field choose Insert at cursor position from the drop-down-menu.

Close the Manage External Tools-window and test the new keyboard-shortcut in the main gedit window.

Reference: Timestamp Keyboard Shortcut In gedit

DK Bose
  • 44,553
mook765
  • 18,644
2

Adding to the accepted answer, I have put together a GitHub project with some additional information and a Gedit extension file that can be directly downloaded and then copy/pasted into location -

https://github.com/harrison-broadbent/gedit-insert-date

Hope anyone stumbling on this finds this project useful!