Howdoi use howdoi in Emacs?
Howdoi use howdoi in Emacs?
One of my favorite things about howdoi is the portability - meaning that you can get instant coding answers anywhere (not just on the command line). Contributors have created integrations for howdoi on Slack, Telegram, Discord, Visual Studio Code, and Alfred (just to name a few!).
As an Emacs user, you can use the code snippet below to get instant answers inside Emacs.
(defun howdoi (start end command)
(interactive
(let ((command "xargs -0 howdoi"))
(if (use-region-p)
(list (region-beginning) (region-end) command)
(list (line-beginning-position) (line-end-position) command))))
(let ((response (shell-command-on-region-to-string start end command)))
(kill-new response)
(save-excursion
(end-of-visual-line)
(newline)
(insert (shell-command-on-region-to-string start end command)))))
(defun shell-command-on-region-to-string (start end command)
(with-output-to-string
(shell-command-on-region start end command standard-output)))
Then, when you want to know how to # format a date in bash
you can invoke M-x howdoi
on that line and voila!
vim