Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[feature discussion] ivy-set-actions universal #337
Would it be possible to have a a sort of universal ivy-set-actions to add an action to everything that uses ivy-read. My particular use case would be to hit "M-o i" to insert whatever text I have selected in the ivy-buffer at my point. I imagine that this feature could have other uses.
I was able to add this feature by changing some 3 lines of code. I can make a pull request if this seems like a feature that others would want.
I have the following code in my init file:
(ivy-set-actions t '(("z" insert "insert")))
It works fine (allows me to insert the selected text, or do the default action) when I use some functions such as counsel-describe-function, counsel-describe-variable and ivy-switch-buffer but when I use kill-buffer or various other functions (some that call ivy-completing-read and other that call completing-read) I get
when I hit enter. Also when using those functions that give a bug, if I hit M-o in the search buffer no list of keybindings appear. No matter which key I hit, be it "o" or "z" I get the same message "key is not bound"
added a commit
Jan 28, 2016
It seems to do both actions (the default, and insert) for any function that is not in ivy--actions-list, this includes inserting text before killing a buffer ('kill-buffer), this raises an issue in read only buffers (makes them unclosable unless being killed from some different buffer). Any function that already has an entry in ivy--actions-list seems to work perfectly.
Please try to be more precise when describing a problem. It would make things easier for me if each issue had:
Right now, since some of the info is missing, I don't really know what you want me to do, if anything.
It's also nice, if possible, to divide the issue into smaller independent pieces, rather piling new stuff onto an existing issue. So a follow up to your previous message should go into a new issue.