navigating through files and buffers with the lusty explorer

I think quite a few people are using ido-mode to navigate through files an and buffers; we discussed it here already a long time ago. I am a happy ido-user myself – it took me some time to fully get full accustomed to the key bindings, but now it feels very natural. Definitely an improvement of my emacs user experience.

However, I am always looking for new things – and one of those is a sort-of ido-mode substitute. It's called the Lusty Explorer and it's the emacs implementation of an existing vim-plugin. It's quite similar to ido-mode; the difference is mainly that it shows all the files or buffers at the same time, in the way that shells (say, bash or zsh) do auto-completion.

The best way to show how it works is using an screencast (note, this is of a slightly older version). Lusty Explorer uses fuzzy matching; that means that I can type /etc/fo, and all items in /etc/ with names f.*o match.

To install lusty-explorer, simply copy lusty-explorer.el to your load-path, and put something like the following in your .emacs:0

(when (require 'lusty-explorer nil 'noerror)

  ;; overrride the normal file-opening, buffer switching
  (global-set-key (kbd "C-x C-f") 'lusty-file-explorer)
  (global-set-key (kbd "C-x b")   'lusty-buffer-explorer))

Side-note, the (when (require 'lusty-explorer nil 'noerror) ...) is there just make sure that no error is raised when lusty-explorer is not found, and the rest is ignored in that case. I use this construct for all packages that are not necessarily available everywhere I use my .emacs; thus, they will simply be ignored and not cause startup errors.

I've been using Lusty Explorer for about a week now, and I am quite happy with it. I still need some time (and maybe some more customization) to get used to the way it works - for example, I found the way ido-mode handles backspace a bit smarter. Also, ido-mode can be customized to a much greater extent. That might merely be a factor of the relative age of the packages – and I haven't really felt the need to customize Lusty Explorer too much. For now, I think I'm going to keep on using it. It's worth a try at least!


Alex said...

Interesting trick with require. I've been using:

(defun maybe-load-library (libname)
"Try and load library 'libname' if it is in the path"
(if (locate-library libname)
(load-library libname)))

Which I think achieves the same result. I guess (require) must have seen a file to know that it supplies a given feature?

Steven Haryanto said...

Interesting. On a somewhat unrelated note, what I'm wishing is some kind of mc-like interface inside emacs. Aside from emacs, mc is what I use the most when I'm in terminal/vconsole.

aron said...

Nice. Will explore.

Anonymous said...

"lusty" is nice but i don't think i'll be leaving "anything" any time soon :)

@steven haryanto
if you want something MC like for emacs have a look at "sunrise commander" ( http://www.emacswiki.org/emacs/Sunrise_Commander ) i can't vouch for it as i'm not a user and i never really was a mc fan to begin with so i can't really judge it but i'm told it's close enough as to make mc diehards feel at home

me, i'll keep using good old plain dired ;)

Anonymous said...

IMHO nothing beats swbuff for quick buffer switching. I've bound the buffer-switching functions to C-TAB and C-S-TAB, allowing me to switch buffers the same way you can switch tabs in e.g. Firefox.


Anonymous said...

I just tried it out, but I did not really see what is the advantage over ido.


Note: I always use ido with "fuzzing matching"
(setq ido-enable-flex-matching t)

djcb said...

@Anonymous: for file navigation, I like the way LE shows them (like a shell); for buffers, I think I actually prefer the ido-way. Probably depends on how many you have.

Anonymous said...

another candidate build on top of ido is smex http://github.com/nonsequitur/smex you should have a look at it.

jeddak said...

Wicked cool. I've mapped lusty file explorer to C-x C-f.

Richard said...

I cant see any advantage over ido which is better for things like files not in current directory. ido supports fuzzy matching too.