punassuming / ranger.el

Bringing the goodness of ranger to dired!
699 stars 52 forks source link

read-directory-goto command? #112

Closed alphapapa closed 8 years ago

alphapapa commented 8 years ago

I often find myself wanting to navigate to a different directory in a completely different place, but I can't find a command to do this in ranger or deer. For example, in ranger (the Python program), when I press cd, I can type the path to a new directory and go to it. I can't seem to find a way to do this in ranger.el. It seems like a ranger-read-directory-goto-type command would be helpful. Am I missing something?

Thanks.

punassuming commented 8 years ago

@alphapapa, what happens when you type f and navigate through the directory path like ../

alphapapa commented 8 years ago

That does it, thanks.

Maybe the docstring and/or function name should be changed to be a bit more descriptive. I thought ranger-search-files and Search for files / directories in folder meant to search for names in the current directory, like typing / in Ranger. It seems more like a ranger.el version of find-file, so maybe ranger-find-file? Although even that seems a bit unintuitive given the Emacs-specific nature of the find-file command. So maybe something like ranger-goto with a docstring like:

"Open a file or go to a directory, like `find-file'"

What do you think?

punassuming commented 8 years ago

We already have a ranger-find-file, but lets change it to 'ranger--find-fileand makeranger-search-filesasranger-find-file` with a better doc string. If you are interested in helping out, please submit a PR, otherwise I can get it updated sometime in the next week.

alphapapa commented 8 years ago

Okay, here's a PR. :) I renamed the functions as you suggested.

I also removed the binding of } to ranger--find-file, because in Ranger that runs traverse, which ranger.el doesn't have, so it seems redundant since RET and mouse-1 run ranger--find-file.

I also ran whitespace-cleanup in a separate commit (I have it in a save hook in Emacs, so I had to keep undoing the cleanup to keep the commits clean... :)

punassuming commented 8 years ago

@alphapapa, I took your changes and modified it a bit. I had forgotten that ranger-find-file was an interactive function. I renamed ranger-search-files to ranger-travel ro be consistent with the ranger :travel function.

alphapapa commented 8 years ago

Cool! :D