Ranger File Manager Commands Wiki ( Generated by ChatGPT )

Welcome to the Ranger File Manager Commands Wiki! This document provides a comprehensive overview of all the commands available in Ranger, a powerful and customizable terminal-based file manager with Vim-like keybindings. Whether you’re a beginner or an advanced user, this wiki will help you navigate and utilize Ranger’s full potential.


Table of Contents

  1. Introduction
  2. Basic Navigation
  3. File Operations
  4. Directory Operations
  5. Viewing and Previewing
  6. Search and Filter
  7. Marks and Bookmarks
  8. Tabs and Panes
  9. Plugins and Custom Commands
  10. Keybindings
  11. Command Line
  12. Configurations
  13. Advanced Commands
  14. Troubleshooting
  15. Additional Resources

Introduction

Ranger is a terminal-based file manager that offers a rich set of features inspired by Vim. It provides a minimalistic and efficient interface for managing files and directories, making it a favorite among power users and developers.

Features

  • Vim-like Keybindings: Navigate and perform actions using familiar Vim commands.
  • Multi-pane Layout: View multiple directories simultaneously.
  • Extensible: Supports plugins and custom commands for enhanced functionality.
  • Preview Pane: View file contents and metadata without opening files.
  • Search Integration: Integrate with tools like fzf for fuzzy searching.

Basic Navigation

Navigate through the file system using the following commands:

Command Description
h or Left Arrow Move to the parent directory
l or Right Arrow Open the selected file or directory
j or Down Arrow Move the cursor down
k or Up Arrow Move the cursor up
gg Jump to the top of the file list
G Jump to the bottom of the file list
/ Start searching for files/directories
n Move to the next search result
N Move to the previous search result
gg Jump to the first file in the list
G Jump to the last file in the list

Example

  • Press j to move the selection down.
  • Press l to open a directory or file.

File Operations

Perform various file operations with the following commands:

Command Description
yy Yank (copy) the selected file
dd Delete the selected file
pp Paste the yanked file into the current directory
cc Copy the selected file to the current directory
mv Move the selected file to a new location
:rename <new_name> Rename the selected file
:mkdir <directory_name> Create a new directory
:touch <file_name> Create a new empty file

Example

  • Press yy to copy a file, navigate to the desired directory, and press pp to paste it.
  • Press dd to delete a file after confirming the action.

Directory Operations

Manage directories efficiently using these commands:

Command Description
:mkdir <directory_name> Create a new directory
:rmdir <directory_name> Remove an empty directory
:cd <path> Change the current directory
:ls List the contents of the current directory
:tree Display the directory tree

Example

  • To create a directory named Projects, press : to open the command prompt and type mkdir Projects, then press Enter.

Viewing and Previewing

Enhance your file viewing experience with these commands:

Command Description
gg Jump to the top of the file list
G Jump to the bottom of the file list
:open <file> Open a file with the default application
:preview Toggle the preview pane
:toggle_view Switch between different view modes

Example

  • Press :preview to toggle the preview pane on or off.
  • Select a file and press l to open it with the default application.

Search and Filter

Quickly find files and directories using these search and filter commands:

Command Description
/ Start searching for files/directories
? Search backwards
n Next search result
N Previous search result
:filter <pattern> Filter files by pattern
:clear_filter Remove the current filter

Example

  • Press / and type report to search for files containing “report” in their names.
  • Press n to navigate to the next occurrence.

Marks and Bookmarks

Save your favorite locations and quickly navigate to them:

Command Description
m <a-z> Set a mark with a letter (e.g., ma)
' <a-z> Jump to the marked location
:bookmark <name> Create a bookmark with a name
:goto_bookmark <name> Jump to the bookmark
:list_bookmarks List all bookmarks
:delete_bookmark <name> Remove a bookmark

Example

  • Press ma to mark the current directory as mark a.
  • Press 'a to jump back to the marked directory.

Tabs and Panes

Organize your workspace using tabs and panes:

Command Description
t Open a new tab
T Close the current tab
gt Switch to the next tab
gT Switch to the previous tab
:split Split the current pane horizontally
:vsplit Split the current pane vertically
:resize <size> Resize the current pane
:close_pane Close the current pane

Example

  • Press t to open a new tab and navigate to a different directory.
  • Use gt and gT to switch between tabs.

Plugins and Custom Commands

Extend Ranger’s functionality with plugins and custom commands:

  • ranger_devicons: Adds file icons for better visual identification.
  • fzf-ranger: Integrates fzf for fuzzy searching within Ranger.
  • ranger_bookmarks: Enhances bookmark management.

Custom Commands

You can create custom commands in commands.py to automate repetitive tasks.

Example: Git Branch Selector

```python from ranger.api.commands import Command import subprocess

class git_branch(Command): “”” :git_branch

Use fzf to select and checkout Git branches.
"""
def execute(self):
    branches = subprocess.check_output(['git', 'branch'], universal_newlines=True)
    branches = [b.strip().lstrip('* ') for b in branches.split('\n') if b]
    selected = self.fm.execute_command(['fzf'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, input='\n'.join(branches)).stdout.strip()
    if selected:
        self.fm.execute_command(['git', 'checkout', selected])
        self.fm.notify(f'Checked out to {selected}') :w