Closed rchar01 closed 6 years ago
Personally I just use arrow keys. However for your task you can try to add to your config file
(define-key ztree-mode-map "n" 'next-line)
(define-key ztree-mode-map "p" 'previous-line)
Thanks, I added to my init.el:
(use-package ztree
:bind (("<f8>" . ztree-dir)
("C-<f8>" . ztree-diff)
:map ztree-mode-map
("n" . next-line)
("p" . previous-line)
("f" . ztree-dir-narrow-to-dir)
("b" . ztree-dir-widen-to-parent)))
It is much easier to move around now.
I do not know if this is a bug but the above use-package setting does not work immediately after running ztree (dir or diff). It only works when I run ztree (dir or diff) and then evaluate emacs init.el, not immediately after ztree startup. I also reported this as an issue on the use-package GitHub page.
I also tried (with the same effect) with-eval-after-load
. Works only with:
(require 'ztree)
(define-key ztree-mode-map "n" 'next-line)
(define-key ztree-mode-map "p" 'previous-line)
but I do not want to load the ztree at Emacs startup. Any ideas?
Not sure if I can help here since I dont use use-package and always manually craft "require" in my config, sorry.
I found the solution on use-package page, now I use:
(use-package ztree
:bind (("<f8>" . ztree-dir)
("C-<f8>" . ztree-diff)))
- to bind keys within ztree-dir (local keymaps)
(use-package ztree-dir :bind (:map ztreedir-mode-map ("f" . ztree-dir-narrow-to-dir) ("b" . ztree-dir-widen-to-parent)))
- to bind keys within ztree-dir and ztree-diff (local keymaps):
(use-package ztree-view :bind (:map ztree-mode-map ("n" . next-line) ("p" . previous-line)))
I would recommend update the wiki (either github or better https://www.emacswiki.org/emacs/ZtreeDiff) with this information if you can, this will be a great contribution to ztree!
I'm working on it.
I've added information about the use-package bindings to the wiki. Currently it is on the first page. Do you want me to place it on a separate page?
Thank you for your contribution! its fine.
Is there a way to change default key bindings for next
C-n
and previous lineC-p
ton
andp
?By the way: I think that ztree (dir and diff) is a very good package, I use it every day. Thanks.