Last active
September 25, 2016 14:24
-
-
Save Wilfred/31e8e0b24e3820c24850920444dd941d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'dash) | |
(defun wh/ido-switch-buffer-with-filename () | |
"Switch to a buffer with ido, including the filename in the prompt." | |
(interactive) | |
(let* ((bufs (buffer-list)) | |
(bufs-with-paths | |
(--map (with-current-buffer it | |
(if (buffer-file-name) | |
(format "%s <%s>" (buffer-name) (buffer-file-name)) | |
(buffer-name))) | |
bufs)) | |
(chosen-index | |
(-elem-index | |
(ido-completing-read | |
"Switch to buffer: " bufs-with-paths) | |
bufs-with-paths))) | |
(switch-to-buffer (nth chosen-index bufs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment