xplr takes pride in being an awesome file explorer, but it also lets us perform file management operations by utilizing the existing command-line tools that are designed to do one thing, and do it best. For example,
Create files & directories
Type :
c
f
to create files or :
c
d
to create directories. By default, xplr uses touch
and, mkdir
commands under the hood, but you can configure it to use anything else. Note that you can create multiple files and directories once you are into the "create file/directory" mode. Once done with creating, Press escape
to leave that mode. Also, you can provide paths like ./non/existing/path
, ../../existing/path
and xplr will create them for you.
Alternatively, you can also utilize the xplr shell by typing :
!
. Once you are inside the shell, just type the commands you want to, like touch newfile
, mkdir newdir
etc.
Edit files
Just focus on the target file and type :
e
to open the file in your editor. By default, xplr uses the editor defined in the $EDITOR
environment variable. If nothing is defined, it will fall back to vi
.
Copy and move files
This operation tends to confuse some people coming from vim or some other terminal file manager, as there's no explicit "copy" or "yank". Once you select files and directories by pressing the space bar
or v
, you can go to the target path and paste or move the selected files by typing :
s
c
or :
s
m
. However, if it's too unintuitive for you, you can of-course configure it to behave as you want to. Also, there are plugins like xclip.xplr, wl-clipboard.xplr that utilizes the system clipboard to provide a more intuitive copy-paste experience. Additionally, if you hate that you have to do a lot of navigation for copy-pasting, checkout dual-pane.xplr or context-switch.xplr. With these plugins, you can easily switch between the source and target directories while copying or moving files.
Alternatively, you can also utilize the xplr shell by typing :
!
. Once you are inside the shell, You can access the file under focus via the $XPLR_FOCUS_PATH
variable, or the selected paths via the $XPLR_PIPE_SELECTION_OUT
file. By default, xplr uses the cp
and mv
commands to copy or move files.
Rename and duplicate files
Press r
to rename and ctrl-d
to duplicate the path under focus. By default, xplr uses mv
to rename and cp
to duplicate files. To rename or duplicate multiple paths at-once, you will need to select the paths and invoke the shell by typing :
!
and run a custom command on the paths listed in the $XPLR_PIPE_SELECTION_OUT
file. Or you can use tools like vidir or pipe-rename. See the batch rename hack.
Trash, restore and delete
By default, xplr only supports deleting paths using rm
by (selecting and) typing d
d
. But you can configure it to use the system trash or a custom trash bin. Or maybe, just use the trash-cli.xplr plugin.
Custom operation on files
As you probably already know by now, you can perform any custom operation on the files visible in the table - $XPLR_PIPE_DIRECTORY_NODES_OUT
, or the path under focus - $XPLR_FOCUS_PATH
or the selected paths - $XPLR_PIPE_SELECTION_OUT
etc. just by invoking the xplr shell by typing :
!
. Alternatively, you may want to explore plugins like map.xplr which lets you create and run custom commands interactively, even on multiple files at-once.
Write a comment ...