To copy/move multiple files, just mark them with Space then use
"dd/yy". If you want to operate on multiple files stored in different
directories, you may use "ya/da" to add them to the list of files to
be copied/moved before pasting them.
(Note that the copy/cut buffers can be used for other operations as
well, by using the "%c" macro in your commands. For example, adding
files to the cut/copy buffer using "ya"/"da" then using the :shell -w
printf %c | xargs rm command allows you to delete multiple files in
multiple directories. Remember to clear the buffer once you're done
using "ud"/"uy".)
So add the files with ya
and then use a mapping like xv
:
map xv shell vim %c
As laktak explained, WSL will not translate the file path from Unix pathing to Windows pathing. I just wrote a Gist on how I handle this, reproduced below:
Make sure you have WSL with the Windows 10 Fall Creators Update installed. Ranger uses rifle
as a file handler and you need its config file, rifle.conf
. If you dont have it (should be in ~/.config/ranger/rifle.conf
), run the command ranger --copy-config=rifle
, then edit the resulting file.
To run Windows applications from Ranger, we will use cmd.exe /C start "" <file>
, which works after the Fall Creators Update. We will solve the pathing issue by using sed
to translate the path.
Add below code to your rifle.conf
and you will be able to run Windows applications for the chosen file extensions.
ext docx?|xlsx?|pptx?|pdf = echo "$@" | sed -e 's;/mnt/\(.\);\1:;' -e 's/.*/"&"/' -e 's:/:\\:g' | xargs cmd.exe /C start ""
start
should be able to run applications associated with file extensions implicitly, but if for some reason it doesnt work, you can also explicitly tell start
which executable to run. Just remove the ""
and add one of
excel
, winword
, powerpnt
, AcroRd32.exe
, etc. Note that in this case you will need one line in rifle.conf
for each application. As an example:
ext docx? = echo "$@" | sed -e 's;/mnt/\(.\);\1:;' -e 's/.*/"&"/' -e 's:/:\\:g' | xargs cmd.exe /C start winword
ext xlsx? = echo "$@" | sed -e 's;/mnt/\(.\);\1:;' -e 's/.*/"&"/' -e 's:/:\\:g' | xargs cmd.exe /C start excel
Additional Reading
Best Answer
While not an edit to rc.conf, these key bindings should help. "os" sorts by size first. Pressing "o" will bring up a list of different options. This resource helped me find the answers: http://dquinton.github.io/debian-install/files/ranger-keybinds_quinton.pdf.