Is there a way to open a file from Neotree in a new split window?
I want to achive same functionality as Vim NERDTree shortcuts "i" and "s"
Or is that the wrong approach?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
neotree comes with default bindings of
| for vertical split and
- for horizontal split.
neotree-enter-vertical-split mentioned in my older recommendation below do not exist any more!
I keys are not bound in
So you can use the below after
(define-key neotree-mode-map (kbd "i") #'neotree-enter-horizontal-split) (define-key neotree-mode-map (kbd "I") #'neotree-enter-vertical-split)
Then, when the cursor is on a file name, pressing
i will open that file in a new window after horizontal split.
In case of evil mode, you can do like this
(add-hook 'neotree-mode-hook (lambda () (define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter-vertical-split) (define-key evil-normal-state-local-map (kbd "SPC") 'neotree-enter-horizontal-split) (define-key evil-normal-state-local-map (kbd "q") 'neotree-hide) (define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))