This is a feature request, alongside a proposed implementation.
ivy-use-virtual-buffers is brilliant, and is suggested in the documentation as one of the most basic variables to enable in Ivy. However, it bundles together recent files and bookmarks, which are quite different things. Furthermore, it doesn't treat bookmarks as such, but by design (#567, #347) it only offers the files to which the bookmarks refer.
Given that, it would be nice if Ivy allowed us to choose what to include in the virtual-buffers. If you like the idea, it could go about like:
(defcustomivy-use-virtual-buffersnil"When non-nil, add recent files and/or bookmarks to `ivy-switch-buffer'.The value `recentf' includes only recent files to the virtualbuffers list, whereas the value `bookmarks' does the same forbookmarks. Any other non-nil value includes both.":type '(choice
(const :tag"Don't use virtual buffers"nil)
(const :tag"Recent files" recentf)
(const :tag"Bookmarks" bookmarks)
(const :tag"All virtual buffers"t)))
"Adapted from `ido-add-virtual-buffers-to-list'."
;; start of changes
(let* ((vb-recent recentf-list)
(vb-bkm (delete" - no file -"
(vb-list (cond ((eq ivy-use-virtual-buffers 'recentf)
((eq ivy-use-virtual-buffers 'bookmarks)
(append vb-recent vb-bkm))
(dolist (head vb-list)
;; end of changes
(let* ((file-name (if (stringp head)
(name (cond ((eq ivy-virtual-abbreviate 'name)
((eq ivy-virtual-abbreviate 'abbreviate)
(when (equal name "")
(if (consp head)
(file-name-nondirectory (directory-file-name file-name)))))
(unless (or (equal name "")
(assoc name virtual-buffers))
(push (cons (copy-sequence name) file-name) virtual-buffers))))
(dolist (comp virtual-buffers)
(put-text-property0 (length (car comp))
(setq ivy--virtual-buffers (nreverse virtual-buffers))
If you'd like more comments on why I think this is useful (particularly, the possibility of being able to exclude bookmarks, but keeping recent files, of course), I can expand.
The text was updated successfully, but these errors were encountered:
Nice, I'll do so. But, first, I am a PR noob. I should be able to do it, but don't hesitate to correct me if need be, and please be patient. And, second, I currently don't (yet) have the papers signed with the FSF. I presume this amounts to a tiny change, so it would still be ok. Is that correct?