user1683620
user1683620

Reputation: 91

Create new keybinding in Spacemacs for timestamp with time

I would like to add a new keybinding in Spacemacs for orgmode to insert timestamp with time

It would be something like:

(spacemacs/set-leader-keys "mdh" 'insert-timestamp-with-time)

m => go to major mode d => dates

h => new key to define the insert function

Given the documentation in "usual emacs" it is done with : C-u C-u C-. => calls org-time-stamp with double prefix.

insert-timestamp-with-time does not exist. I do not know how to map a call to org-time-stamp (which exists) with a double prefix.

Upvotes: 0

Views: 45

Answers (1)

user1683620
user1683620

Reputation: 91

I manage to get what i want with :

  (defun insert-inactive-timestamp-with-hour ()
  "Insert an inactive timestamp."
  (interactive)
  (insert (format-time-string "[%Y-%m-%d %a %H:%M:%S]" nil t))
  )


  (with-eval-after-load 'org
    (spacemacs/set-leader-keys-for-major-mode 'org-mode "dh" 'insert-inactive-timestamp-with-hour))

Upvotes: 0

Related Questions