2015-12-02 14:23:39 +00:00
|
|
|
#+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]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2015-07-15 07:43:27 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layer brings Ranger features to spacemacs from the =ranger= package.
|
|
|
|
|
2016-01-06 05:21:55 +00:00
|
|
|
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 default with preview enabled when entering ranger:
|
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-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
|
2016-02-26 21:54:06 +00:00
|
|
|
session. Any settings that are desired on startup should be set below.
|
2015-07-15 07:43:27 +00:00
|
|
|
|
|
|
|
** Customizing
|
2016-12-11 20:17:42 +00:00
|
|
|
You toggle the use of =-= to enter ranger with `ranger-enter-with-minus`.
|
2018-07-10 10:57:25 +00:00
|
|
|
|
2016-12-11 20:17:42 +00:00
|
|
|
#+BEGIN_SRC elisp
|
2018-09-19 03:54:47 +00:00
|
|
|
(setq ranger-enter-with-minus t)
|
2016-12-11 20:17:42 +00:00
|
|
|
#+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
|
|
|
|
|
2016-01-09 20:52:40 +00:00
|
|
|
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
|
2016-01-09 20:52:40 +00:00
|
|
|
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
|
2016-01-09 20:52:40 +00:00
|
|
|
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
|
|
|
|
|
2019-05-26 20:58:52 +00:00
|
|
|
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
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2015-07-15 07:43:27 +00:00
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2017-06-11 09:45:56 +00:00
|
|
|
|-----------------+------------------------------------------------------|
|
|
|
|
| ~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 |
|
|
|
|
| ~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 |
|