This page looks best with JavaScript enabled

Ranger Notes

 ·   ·  โ˜• 2 min read · ๐Ÿ‘€... views

I am planing on totally changing to the terminal based file manager: ranger.

And this is my cheatsheet on using it, for more detailed guides you can go check the ranger official user guide1.

launch

I use $mod+Shift+Return to launch my ranger, and this keybinding is set in the i3 config file as below.

1
2
# ~/.config/i3/config
bindsym $mod+Shift+Return exec cd "$(xcwd)" && exec st -e "ranger"

Here I also use xcwd2 to get my current working directory, so I can launch ranger from that directory.

Key bindings and hints

  • g: navigation and tabs
  • r: open with
  • y: yank
  • d: cut/delete
  • p: paste
  • o: sort
  • .: filter_stack ??
  • z: settings
  • u: undo
  • M: linemode
  • +, -, =: rights
  • Alt+N: switch(Tab), create tab

configuration files

under ~/.config/ranger/ folder, there are 4 main configuration files:

  • rc.conf: the main config, various key bindings and switches
  • rfile.conf: how to open a file
  • scope.sh: how to preview a file
  • commands.py: implement various commands (functions), you can add your custom commands here.

Bookmarks

  • m<key>: bookmark current folder
  • '<key>: go to a bookmark
  • um<key>: remove a bookmark

Select/Mark files

  • SPC: mark current file
  • v: invert selection (easy to select all)
  • V: visual mode, to mark a range of files
  • :mark REGEX, :unmark REGEX: to mark/unmark with regex expression.
  • uv, :unmark: unmark all files

Macros

  • %f: the highlighted file
  • %d: the path of the current directory
  • %s: the selected files in the current directory
  • %t: the tagged files in the current directory
  • %c: the full pathes of the currently copied/cut files
  • %p: the full pathes of selected files

Rename, Create Files & Folders

  • cw: to rename selected file or files (bulk rename, works great with :flat)
  • :mkdir: create directory
  • :touch: create file

TODO drag and drop

https://github.com/ranger/ranger/wiki/Drag-and-Drop


  1. ranger official user guide ↩︎

  2. xcwd is a simple tool that prints the current working directory of the currently focused window. ↩︎

Share on