Question

I am using VIM version 7.3 and I installed NERDTree plugin.

The issue I am facing is that when in run VIM, NERDTree doesn't open by default although it should with the settings below. Also a more CRITICAL issue is that it won't let me browse folders. What I mean by that is. It will list the folders in the current directory but when I try to open a folder by hitting enter it will not expand that folder.

What have I missed here? My .vimrc is given below :

" Start pathogen plugins "
  2 call pathogen#infect()
  3
  4 " Automatic syntax highlight on "
  5 syntax on
  6
  7 " Necessary for NerdCommenter to Work "
  8 filetype plugin indent on
  9
 10 set nocompatible
 11 source $VIMRUNTIME/vimrc_example.vim
 12
 13 " Replace tabs with spaces
 14 set expandtab
 15
 16 " make tab 2 space wide
 17 set tabstop=2
 18 set shiftwidth=2
 19
 20 "Auto indent, smart indent and wrap lines
 21 set autoindent
 22
 23 " stop vim from creating backups
 24 set nobackup
 25 set noswapfile
 26 set nowb
 27 set nowritebackup
 28
 29
 30 set number
 31
 32 set hlsearch
 33 set ignorecase
 35 colorscheme desert
 36 set background=dark
 37
 38
 39 let g:nerdtree_tabs_open_on_console_startup=1
 40
 41 set ff=unix
 42 set showtabline=2
 43 set smarttab
 44 set incsearch
 45
 46 set history=1000
 47
 48 set undolevels=1000
 49 set title
Was it helpful?

Solution

The command let g:nerdtree_tabs_open_on_console_startup=1 works only if you have vim-nerdtree-tabs installed. To open NERDTree at startup you have to insert that command into your .vimrc autocmd vimenter * NERDTree.

OTHER TIPS

It seems like a bug in NERDTree. On my system, NERDTree refused to open only those folders which were the only entry in their parent directory. For example, earlier my Desktop had only a single folder, say X, and that folder(X) contained some other folders, say folderA and folderB. Whenever I would open my 'Desktop' in the NERDTree. It would show folderA and folderB as it's subfolders, instead of X, and it would refuse to open folderA and folderB. Creating an empty directory on my Desktop(and all the other folders causing similar problem) corrected it.

In my case, NERDTree refused to open only one folder - all others were fine. It was unhappy with some temporary file in ~/.local/share/nvim/swap. After I deleted all the files in this folder, NERDTree was working fine again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top