Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change root dir or enter file [Question] #230

Open
ghost opened this issue Mar 11, 2017 · 4 comments
Open

change root dir or enter file [Question] #230

ghost opened this issue Mar 11, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 11, 2017

Hi
I am trying to achieve the following behaviour:
TAB = (1) expand node
RET =
(2) if node is directory, change root to it
(3) if node is a file, open it

Not sure how to achieve this, I've tried with

(define-key neotree-mode-map (kbd "RET") 'neotree-change-root)

that accomplishes (1) and (2) but ruins (3)

How could I do it?

Thanks

@ghost
Copy link
Author

ghost commented Mar 11, 2017

A bit of why would anyone (or at least me) this behaviour.. becouse sometimes I want to explore the tree and then decide a directory to work on

@aborn
Copy link
Collaborator

aborn commented May 7, 2017

(define-key map (kbd "RET")     (neotree-make-executor
                                     :file-fn 'neo-open-file
                                     :dir-fn  'neo-open-dir))

The default behaviour RET have accomplished the (2) and (3)

@pierwill
Copy link

pierwill commented Dec 6, 2018

The above isn't working for me.

I've tried neotree-change-root and neo-buffer--change-root in the above.

I'm looking to have RET always change root dir..

Any help would be appreciated!

@julienlabbe
Copy link

Late reply.

Try with a lambda function:

(define-key neotree-mode-map (kbd "RET")  
        (neotree-make-executor :dir-fn  '(lambda (full-path arg) (neotree-change-root))))

I'm not sure this will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants