This is a minor mode that can be enabled from a dired buffer. Once enabled it will show the file from point in the other window. Moving to the other file within the dired buffer with down/up or C-n/C-p will display different file. Hitting SPC will scroll the peeped file down, whereas C-SPC and backspace will scroll it up.
Once you have setup Melpa you can use package-install
command to install Peep Dired. The package name is peep-dired
.
When disabling the mode you can choose to kill the buffers that were opened while browsing the directories.
(setq peep-dired-cleanup-on-disable t)
Or you can choose to kill the buffer just after you move to another entry in the dired buffer.
(setq peep-dired-cleanup-eagerly t)
If you want the dired buffers that were peeped to have the mode enabled set it to true.
(setq peep-dired-enable-on-directories t)
Adjust the state name depending on an evil state you open dired in:
(evil-define-key 'normal peep-dired-mode-map (kbd "<SPC>") 'peep-dired-scroll-page-down
(kbd "C-<SPC>") 'peep-dired-scroll-page-up
(kbd "<backspace>") 'peep-dired-scroll-page-up
(kbd "j") 'peep-dired-next-file
(kbd "k") 'peep-dired-prev-file)
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
You probably don't want to open certain files like videos when using Peep Dired. To ignore certain files when moving over them you can customize the following to your liking:
(setq peep-dired-ignored-extensions '("mkv" "iso" "mp4"))
Install cask if you haven't already, then:
$ cd /path/to/peep-dired
$ cask
Run all tests with:
$ make test