(ido-switch-buffer), when I type
"*magit: stuff*" comes before
the sorting seems to be done by recency, rather than the buffer name. more generally, a custom sort function would be nice.
Here is what I use:
(require 'dash) (require 's) (add-hook 'ido-make-buffer-list-hook 'my/ido-stars-to-end) (defun my/ido-stars-to-end () "Put \"*starred*\" buffers at the end of the ido candidates list." (ido-to-end (--filter (s-starts-with-p "*" it) ido-temp-list)))
If you want just for ido locally and not across tramp listings, then try this function that was originally made for buffers with @ in names and I modified for * in names:
(defun ido-sort-on-stars-to-end () (message ido-current-directory) (setq ido-temp-list (sort ido-temp-list (lambda (a b) if (not (or (char-equal (string-to-char a) ?*) (char-equal (string-to-char b) ?*))) (time-less-p (sixth (file-attributes (concat ido-current-directory b)) (sixth (file-attributes (concat ido-current-directory a))))) nil))) (ido-to-end (delq nil (mapcar (lambda (x) (and (string-match-p "^\\.." x) x)) ido-temp-list))))