Code Monkey home page Code Monkey logo

Comments (4)

blueyed avatar blueyed commented on May 16, 2024

Just use a mapping like the following to execute NERDTree for the current file's directory:
noremap n. :execute "NERDTree ".expand("%:p:h")

I have created some more "n"-prefixed mappings here:

noremap <Leader>n :NERDTree<space>
noremap <Leader>nb :NERDTreeFromBookmark<space>
noremap <Leader>nn :NERDTreeToggle<cr>
noremap <Leader>no :NERDTreeToggle<space>
noremap <Leader>nf :NERDTreeFind<cr>
noremap <Leader>nc :NERDTreeClose<cr>

from nerdtree.

blueyed avatar blueyed commented on May 16, 2024

In your case, you would have to use some autocommand to change to the current directory, if that's what you want really.

from nerdtree.

bitboxer avatar bitboxer commented on May 16, 2024

At the moment I am using a solution borrowed from Janus:

https://github.com/carlhuda/janus

It simply rewrites the default commands for cd and a few other commands:

" Define the NERDTree-aware aliases
call s:DefineCommand("cd", "ChangeDirectory")
call s:DefineCommand("touch", "Touch")
call s:DefineCommand("rm", "Remove")
call s:DefineCommand("e", "Edit")
call s:DefineCommand("mkdir", "Mkdir")

and the new methods will change the directory of the nerdetree accordingly.

from nerdtree.

PhilRunninger avatar PhilRunninger commented on May 16, 2024

You can use the shortcut ZyX gave in Stackoverflow.

nnoremap \f :NERDTree .<CR>

I don't see any autocmd in the list that would respond to a changing directory, but the quick \f keypress will give you the tree you want.

from nerdtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.