Emacs: M-y as helm-show-kill-ring
Posted: - Modified: | emacsAfter realizing that I barely scratched the surface of Helm's awesomeness (really, I basically use it as an ido-vertical-mode
), I made a concerted effort to explore more of the interesting things in the Helm toolkit. helm-show-kill-ring
is one such thing. I've bound it to M-y
, which I had previously configured to be browse-kill-ring
, but helm-show-kill-ring
is much cooler because it makes it easy to dynamically filter your kill ring. Also, Kcode>M-y works better for me than C-y
does because I know when I want the last thing I killed, but going beyond that is a little annoying.
That said, browse-kill-ring
does make it easy to edit a kill ring entry. Maybe I should learn how to modify Helm's behaviour so that I can add an edit action. There's already a delete action. Besides, I haven't used that feature in browse-kill-ring
yet, so I can probably get by even without it.
ido
fans: you can use helm-show-kill-ring
without activating helm-mode
, if you want.
On a related note, I like how rebinding M-x
(execute-extended-comand
) to helm-M-x
shows me keybindings as I search for commands. You do have to get used to the quirk of typing C-u
and other prefixes after M-x
instead of before, but I haven't had a problem with this yet. This is mostly because I haven't dug into just how many commands do awesome things when given a prefix argument. I know about using C-u C-c C-w
(org-refile
) to jump to places instead of refiling notes, but that's about it. I haven't gone anywhere close to C-u C-u
. Does anyone have a favourite command they use that does really smart things when given that prefix? =)
This Helm intro has animated GIFs and a few other useful commands. Check it out!
18 comments
mbork
2014-12-10T14:14:14ZTwo examples of useful C-u C-u, off the top of my head: org-capture and my own switch-bury-or-kill-buffer (see http://mbork.pl/2014-04-04_....
And, what is it about helm/ido that Icicles doesn't have?
mbork
2014-12-10T17:16:13ZAlso, magit-status.
NoonianAtall
2014-12-12T01:49:57ZI used to use Icicles, but one look at its emacswiki page is enough to send anyone running, I think. Trying to understand and configure it is nearly an unsurmountable task.
But helm is quick and easy to use by comparison, and yet very powerful. If you've mastered Icicles, maybe you won't see the point in switching (though I don't know if Icicles can do /everything/ Helm does), but otherwise, you should give it a try. :)
sachac
2014-12-13T18:26:37ZI hadn’t noticed that org-capture had such useful C-u and C-u C-u behaviours. Thanks! I often find myself wanting to go to my current journal note, so C-u C-u will come in handy.
I haven’t used Icicles enough to tell you what the significant differences are, but maybe someone else can. =)
NoonianAtall
2014-12-22T16:17:52ZI'm sure you could make this yourself, but just in case you might find this useful, here's what I use to jump to the current date in my log.org datetree file (too bad about the formatting :( ):
;; Go to current day in datetree
(defun me/org-goto-current-datetree-entry ()
(interactive)
(me/start-org-if-necessary)
(switch-to-buffer "log.org")
(org-set-startup-visibility)
;; This doesn't reveal the node
(org-datetree-find-date-create (list (string-to-number (format-time-string "%m"))
(string-to-number (format-time-string "%d"))
(string-to-number (format-time-string "%Y"))))
(org-reveal '(4))
(org-cycle))
(global-set-key (kbd "<f7>") 'me/org-goto-current-datetree-entry)
(defun me/start-org-if-necessary ()
"If the 'main.org' buffer isn't open, open the agenda, which will cause all the agenda buffers to load."
(when (not (get-buffer "main.org"))
(org-agenda-list)))
sachac
2014-12-26T03:06:33ZNoonianAtall: Oh! So I tried out C-u org-capture to jump to the appropriate part of my date-tree. Then I switched to using :unnarrowed t as part of my org-capture-templates entry for the journal, which was even more convenient. =) So I don't need to use a special function to navigate to a datetree, since org-capture takes care of that for me.
tuhdo
2014-12-19T03:34:47Z> And, what is it about helm/ido that Icicles doesn't have?
Many 3rd party packages use Helm/Ido. I tried Icicles long ago, but performance is the that prevented me to use it. When you have like 50 packages, M-x with Icicles starts getting slow. It gets worse the more packages you have.
With Helm, it's fast. I can filter from even one hundred thousand candidates easily (i.e. I once enabled Projectile with my home directory). And it has Projectile integration: http://tuhdo.github.io/helm...
With Helm, it does not hide anything. With stock Emacs, if you have something to complete, you have to press TAB to get the list. Helm always makes it visible by showing you in a nice menu without doing anything.
Helm has cool 3rd party packages like `helm-grep/ack/ag` that provides interactive ag, see results as you type. This is only available in Helm and nowhere else.
xoo
2014-12-10T15:51:56Zthere's also helm-mark-ring
sachac
2014-12-13T18:26:17ZI have C-x c SPC as helm-all-mark-rings which looks really useful, but M-x helm-mark-ring just prompts for a pattern and then doesn’t seem to do anything. I’m probably missing something here! =)
Helllo
2014-12-10T18:02:26ZC-u C-SPC
C-u C-CPC C-SPC C-SPC...
sachac
2014-12-13T18:22:32ZHelllo: Ah yes, pop-to-mark-command with set-mark-command-repeat-pop set to non-nil. That one's handy. =)
RafaelGP
2014-12-11T15:37:57ZIf you're looking for more Helm's awesomeness, don't miss "helm-apropos"
It allows you to search dynamically Commands, Functions, Variables and Faces. All at once!
One command to rule them all:
- apropos-command
- describe-function
- describe-variable
- describe-font
sachac
2014-12-13T18:23:12ZRafaelGP: Indeed! I’ve bound that to C-h a.
NoonianAtall
2014-12-12T02:25:37ZSacha, I've been using Helm and even helm-show-kill-ring for a while now...but somehow it never hit me that that means I can filter the kill ring candidates, just like everything else in Helm. *facepalm* Right under my nose! :D
sachac
2014-12-13T18:23:42ZI know, right! Just the other week, I found out that helm-swoop is editable. And it even says so, right there.
NoonianAtall
2014-12-22T15:56:05Z...You just did it again. :) (Though I think I vaguely recall reading about that ability when I first learned about Helm...but then immediately forgot about it.) This is really neat when used with iedit-mode, almost like a lightweight refactoring mode.
I just wish that Helm were a bit easier to expand on. For an elisp newbie like me, trying to follow the Helm code and figure out how to add my own files source is...well, I haven't succeeded, yet, haha.
sachac
2014-12-26T03:06:56ZNoonianAtall: I haven't even tried adding sources yet. I'll get to that someday. =)
summaminutiae
2015-12-27T19:27:17ZThanks for this! I used to have M-y bound to some kill-ring list thing and lost it somewhere along the way. This is even better that the one I used to use.