max6166 <max6...@hotmail.com> writes:

> There are many emacs commands after which I almost always immediately want
> to insert text. This often requires entering insert mode after the initial
> command.
>
> Is there any way to instead enter insert mode automatically after certain
> commands?
>
> For example, in org-mode, a user will usually enter some text immediately
> after the commands org-insert-heading or org-capture. 
>
> Though this only requires typing <i>, the situation arises so many times in
> a day that I find myself wishing I could eliminate that extra key press.
>
> What would be the recommended way to do this? 
>
> Incidentally, I am also using evil-org-mode. 

I would try adding a function to `post-command-hook' that enters
instert-mode when `insert-command' is in a list of symbols.

Totally untested code:

(defvar maybe-enter-insert-mode-commands
  '(org-insert-heading)
  "List of commands that trigger insert mode.")

(defun maybe-enter-insert-mode ()
  (when (memq last-command maybe-enter-insert-mode-commands)
     (evil-insert-state nil)))

(add-hook post-command-hook 'maybe-enter-insert-mode)


_______________________________________________
implementations-list mailing list
implementations-list@lists.ourproject.org
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list

Reply via email to