-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Quit when where is no active buffer #21
Comments
thanks! this is exactly what I was looking for! (if you have a StackOverflow account, you may want to link this here) |
A better version appears to be the one used in the janus repo:
|
It's perfect thanks you :) |
Hey guys This is currently not something that im keen to put in the core plugin, but you can stick something like this in your vimrc to achieve the same thing:
|
excellent |
Thanks! Been looking for this for some time, got it from here; http://stackoverflow.com/questions/2066590/automatically-quit-vim-if-nerdtree-is-last-and-only-buffer |
The solutions above don't seem to account for buffers that are hidden. They close out of vim with hidden buffers still present. Is there something I'm missing? |
Thanks! This really helps me. |
thanks,it works! |
O joy! scrooloose's one liner works! |
For anyone coming here from Stack Overflow, the one liner above no longer works. The README now says to use this:
|
michaelkebe's is also not working - It also closes vim when I try to switch to the nerdtree window with Ctrl-w p |
@justonia thanks !! it is wonderful . I am the guy come from stackoverflow.
Any how. Thanks you very much! |
@justonia thank you! |
Thank you! Worked great! |
Checking on NERDTreeType no longer works after an update. Now only @justonia 's answer works. |
I tried @justonia 's answer, and find it normally work if default open with tree view. Any idea? |
Hi. |
I'm afraid I can't replicate your problem. The above snippet does exactly what it claims to do in my Vim installation. What other customizations are you using? In what script are you running this snippet? |
Sorry guys. I tried several times again with other scripts and finally it seems my problem solved with this script: " Close all open buffers on entering a window if the only |
I am also having an issue with the following script:
Running Vim 8, ZSH, and iterm on OSX. :q will freeze the window. If I instead :w and then :qall, vim closes everything as expected. It only freezes when I have opened vim with a specific file. |
@jcconnell Suspect that you might have some config/plugin that opens buffers in the background (hidden). Maybe posting the whole vimrc file will help to diagnose it |
@texasbruce, thank you! Here is my vimrc: |
Still can't figure this out. Any ideas? |
@jcconnell Try adding these in the front of the whole .vimrc file:
and settings for NERDtree:
|
@texasbruce thank you! I tried these settings but I'm still experiencing the same problem. I was able to make a little progress but removing the ! from the following line: The currently open file buffer closes, but the NERDTree buffer remains open and the whole pane freezes. |
@jcconnell Have you tried to disable other plugins and see if this works? |
Yes, I've tried disabling all plugins one by one and I'm still having the same problem. |
@justonia your answer is work for me. but i use deoplete in neovim, now when i quit vim with a nerdtree opened, deoplete will launch 4 python progress and take 100% cpu. |
@alexsunxl thank you so much! your solution works on neovim. |
Variant with Any ideas? |
@dvdesolve It looks like you have a very old version of NERDTree installed. The
|
Method 1 gives |
In vim, type |
Update to the latest NERDTree solved the problem. Thank you! |
And so... after all of the back & forth, I'm confused. What is it exactly I need in my .vimrc file on a Linux machine running vim ver 8.2? |
@seamusdemora I believe that the thing you are looking for has been addressed in this section of FAQ. If you need any more help with your case, feel free to create a new issue for it. |
@rzvxa : Thanks - I missed the FAQ when I looked earlier. Very handy collection! |
the autocmd condition in all above scripts better be changed from BufEnter to SafeState, otherwise it won't work on newer versions of vim with mutiple tabs. |
@SleepyToDeath Thanks for bringing it up, I have to admit it is a really good addition; Sadly it isn't still supported in the In the NERDTree itself, there are only 2 occurrences of As for the Feel free to contribute to any of these 2 areas. I personally think only adding examples with SafeState to FAQ is enough but I wouldn't object if you also change the plugin initialization behavior to get rid of BufEnter in environments where SafeState exists. |
Sorry to be the pest, but the FAQ doesn't mention where (i.e. which file) to put this... e.g. in |
@seamusdemora No worries mate, Yes these are some common configurations and macros for NERDTree, You can copy-paste them into your vimrc to use them. Use them to write your own config the way it suits your needs. You may not need most of them or don't like the way some of them work, So only use the ones that help your case. |
hello, i tried to use the Q&A method Or the plugin
could somebody help pls? vim version 9.1.150 |
Hey @zhitongLIU, check the #1411 out. We have to update our FAQ section to reflect Vim9 specifications (in short, you cannot use the |
yes work like a charm, thank you for quick responds! |
It would be great if there is no need to quit the NERD_tree* buffers to quit Vim.
Maybe this can be put into the NERDTree as an option?
I have created a small function to get this feature. Just put this code into your
.vimrc
:Greetings
Michael
The text was updated successfully, but these errors were encountered: