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/README.org

168 lines
6.2 KiB
Org Mode
Raw Normal View History

#+TITLE: Ranger layer
2015-07-15 07:43:27 +00:00
2019-05-02 21:49:30 +00:00
#+TAGS: layer|tool
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description][Description]]
2017-08-28 21:58:10 +00:00
- [[#features][Features:]]
2017-05-22 14:16:12 +00:00
- [[#configuration][Configuration]]
- [[#customizing][Customizing]]
- [[#parent-options][Parent options]]
- [[#preview-options][Preview options]]
- [[#key-bindings][Key bindings]]
2015-07-15 07:43:27 +00:00
* 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.
2015-07-15 07:43:27 +00:00
To use ranger/deer by default set ~ranger-override-dired~ to ~ranger/deer~ like
shown in the example below (setting this via customize as explained by the
original [[https://github.com/ralesi/ranger.el#installation][ranger installation instructions]] will not work). To default with
preview enabled when entering ranger set ~ranger-show-preview~ to ~t~. The following
example code shows how you can set both variables at once via the
~dotspacemacs-configuration-layers~ of your dotfiles as follows:
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC emacs-lisp
2018-09-19 03:54:47 +00:00
(setq-default dotspacemacs-configuration-layers
'(ranger :variables
ranger-override-dired 'ranger
2018-09-19 03:54:47 +00:00
ranger-show-preview t))
2015-07-15 07:43:27 +00:00
#+END_SRC
2017-08-28 21:58:10 +00:00
** Features:
2015-07-15 07:43:27 +00:00
- 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.
2015-07-15 07:43:27 +00:00
** Customizing
Toggle the use of =-= to enter deer or ranger with =ranger-enter-with-minus=.
The possible values are:
- ='deer= (default)
- ='ranger=
- =nil= (restores the default behavior of =-=)
2018-07-10 10:57:25 +00:00
#+BEGIN_SRC elisp
(setq ranger-enter-with-minus 'deer)
#+END_SRC
2015-07-15 07:43:27 +00:00
When disabling the mode you can choose to kill the buffers that were opened
while browsing the directories.
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-cleanup-on-disable t)
2015-07-15 07:43:27 +00:00
#+END_SRC
Or you can choose to kill the buffer just after you move to another entry in the
dired buffer.
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-cleanup-eagerly t)
2015-07-15 07:43:27 +00:00
#+END_SRC
You can choose to show dotfiles at ranger startup, toggled by =zh=
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-show-hidden t)
2015-07-15 07:43:27 +00:00
#+END_SRC
Define custom function used to output header of primary ranger window. Must
return a string that is placed in the header-line.
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-header-func 'ranger-header-line)
2015-07-15 07:43:27 +00:00
#+END_SRC
Define custom function used to output header of parent and preview windows. Must
return a string that is placed in the header-line.
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-parent-header-func 'ranger-parent-header-line)
2015-07-15 07:43:27 +00:00
#+END_SRC
** Parent options
You can set the number of folders to nest to the left, adjusted by =z-= and =z+=
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-parent-depth 2)
2015-07-15 07:43:27 +00:00
#+END_SRC
You can set the size of the parent windows as a fraction of the frame size
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-width-parents 0.12)
2015-07-15 07:43:27 +00:00
#+END_SRC
When increasing number of nested parent folders, set max width as fraction of
frame size to prevent filling up entire frame with parents.
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-max-parent-width 0.12)
2015-07-15 07:43:27 +00:00
#+END_SRC
** Preview options
You can choose to show previews literally, or through find-file, toggled by =zi=
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-show-literal t)
2015-07-15 07:43:27 +00:00
#+END_SRC
You can set the size of the preview windows as a fraction of the frame size
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-width-preview 0.55)
2015-07-15 07:43:27 +00:00
#+END_SRC
You probably don't want to open certain files like videos when using preview. To
2015-07-15 07:43:27 +00:00
ignore certain files when moving over them you can customize the following to
your liking:
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-ignored-extensions '("mkv" "iso" "mp4"))
2015-07-15 07:43:27 +00:00
#+END_SRC
To set the max files size (in MB), set the following parameter:
2018-07-10 10:57:25 +00:00
2015-07-15 07:43:27 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(setq ranger-max-preview-size 10)
2015-07-15 07:43:27 +00:00
#+END_SRC
* Key bindings
2015-07-15 07:43:27 +00:00
| Key binding | Description |
|-----------------+------------------------------------------------------|
| ~SPC a t r r~ | launch ranger |
| ~SPC a t r d~ | deer (minimal ranger window in current directory) |
| ~C-p~ | (ranger) toggle ranger in dired buffer |
| ~j~ | (ranger) navigate down |
| ~k~ | (ranger) navigate up |
| ~yy~ | (ranger) copy |
| ~pp~ | (ranger) paste |
| ~R~ | (ranger) rename |
| ~D~ | (ranger) delete |
| ~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 |
| ~;g~ | (ranger) revert buffer |
| ~z-~ | (ranger) reduce number of parents |
| ~z+~ | (ranger) increment number of parents |
| ~C-SPC~ / ~TAB~ | (ranger) mark current file |
| ~v~ | (ranger) toggle all marks |
| ~t~ | (ranger) toggle mark current file |
| ~S~ | (ranger) enter shell |
| ~;C~ | (ranger) copy directory / copy and move directory |
| ~;+~ | (ranger) create directory |