This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/ranger
2016-03-30 22:59:55 -04:00
..
packages.el Clean copyrights and update for year 2016 2016-01-11 21:42:17 -05:00
README.org Convert org doc files with doc-fmt 2016-03-30 22:59:55 -04:00

Ranger layer

Description

This layer brings Ranger features to spacemacs from the ranger package.

To use this configuration layer, add it to your ~/.spacemacs. You will need to add ranger to the existing dotspacemacs-configuration-layers list in this file.

To default with preview enabled when entering ranger:

(setq-default dotspacemacs-configuration-layers
              '(ranger :variables
                       ranger-show-preview t))

Features

  • use ranger to display dired with ranger like preview and stacked parent windows.

Configuration

Most parameters can be toggled on and off and stay within the current emacs session. Any settings that are desired on startup should be set below.

Customizing

When disabling the mode you can choose to kill the buffers that were opened while browsing the directories.

(setq ranger-cleanup-on-disable t)

Or you can choose to kill the buffer just after you move to another entry in the dired buffer.

(setq ranger-cleanup-eagerly t)

You can choose to show dotfiles at ranger startup, toggled by zh

(setq ranger-show-dotfiles t)

Define custom function used to output header of primary ranger window. Must return a string that is placed in the header-line.

(setq ranger-header-func 'ranger-header-line)

Define custom function used to output header of parent and preview windows. Must return a string that is placed in the header-line.

(setq ranger-parent-header-func 'ranger-parent-header-line)

Parent options

You can set the number of folders to nest to the left, adjusted by z- and z+

(setq ranger-parent-depth 2)

You can set the size of the parent windows as a fraction of the frame size

(setq ranger-width-parents 0.12)

When increasing number of nested parent folders, set max width as fraction of frame size to prevent filling up entire frame with parents.

(setq ranger-max-parent-width 0.12)

Preview options

You can choose to show previews literally, or through find-file, toggled by zi

(setq ranger-show-dotfiles t)

You can set the size of the preview windows as a fraction of the frame size

(setq ranger-width-preview 0.55)

You probably don't want to open certain files like videos when using preview. To ignore certain files when moving over them you can customize the following to your liking:

(setq ranger-ignored-extensions '("mkv" "iso" "mp4"))

To set the max files size (in MB), set the following parameter:

(setq ranger-max-preview-size 10)

Key Bindings

Key Binding Description
SPC a r launch ranger
SPC a d deer (minimal ranger window in current directory)
C-p (ranger) toggle ranger in dired buffer
j (ranger) navigate down
k (ranger) navigate up
C-j (ranger) scroll preview window down
C-k (ranger) scroll preview window up
f (ranger) search for file names
i (ranger) show preview of current file
zi (ranger) toggle showing literal / full-text previews
zh (ranger) toggle showing dotfiles
o (ranger) sort options
H (ranger) search through history
h (ranger) go up directory
l (ranger) find file / enter directory
RET (ranger) find file / enter directory
q (ranger) quit
r (ranger) revert buffer
z- (ranger) reduce number of parents
z+ (ranger) increment number of parents
v (ranger) toggle all marks
V (ranger) visually select lines
S (ranger) enter shell
C-SPC (ranger) mark current file