Comments (4)
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.
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.
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.
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)
- Can't find how to actually select the dropped-down result
- `(m)ove the current node` shortcut doesn't treat filepaths as case sensitive HOT 10
- Unable to open file on newly opened tree after the default tree is closed HOT 4
- Adding change logs for few last merged PRs and create tags for them HOT 10
- How to set the padding width between arrow and the icon HOT 4
- Issue #1368 remote authentication required…. HOT 2
- What's the remap api for nerdtree menu? HOT 2
- Change license to something more standard HOT 3
- Customize key to open quick help menu HOT 3
- Error when loading a vim session: BufLeave NERD_tree_* autocommand: Variable b:NERDTree does not exist HOT 3
- E1208: -complete used without allowing arguments HOT 2
- BUG: NERDTree Hijacked Movement Keys HOT 6
- Installing NERDTree with Vim 9 on Windows 10 HOT 4
- Error detected while processing WinEnter Autocommands for "*"..function <SNR>38_HandleOnlyWindow[13]..<SNR>38_CloseWindow: HOT 1
- Add user choice to follow symlinks or keep them HOT 4
- Installation??? HOT 4
- highlight the current filename in the tree window after following a tag HOT 1
- NERDTree.TreeNotOpen thrown when opening Neovim into NERDTree HOT 4
- Error detected while processing BufEnter Autocommands for "*" with the "Close the tab if NERDTree is the only window remaining in it." config HOT 6
- Error detected while processing function nerdtree#ui_glue#invokeKeyMap[1]..96[18]..95[3]..<SNR>185_openHSplit[1]..125[1]..141[3]..197[6]..198[17]..33: HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nerdtree.