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

"E121: Undefined variable: b:NERDTree" #1

Open
cmdcolin opened this issue Apr 22, 2019 · 1 comment
Open

"E121: Undefined variable: b:NERDTree" #1

cmdcolin opened this issue Apr 22, 2019 · 1 comment

Comments

@cmdcolin
Copy link

Hi there,

I just was trying to use the command

:NERDTreeProjectSave myproj

It gave me the error "E121: Undefined variable: b:NERDTree"

My full vimrc is

set t_Co=256
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
      \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('~/.vim/plugged')
Plug 'editorconfig/editorconfig-vim' " editorconfig, always not fucking working
Plug 'tpope/vim-commentary' " allows typing v-select block then gc to comment block
Plug 'tpope/vim-fugitive' " allows some git commands inside vim
Plug 'joshdick/onedark.vim' " theme
Plug 'vim-airline/vim-airline' " status line
Plug 'leafgarland/typescript-vim'
Plug 'pangloss/vim-javascript'
Plug 'scrooloose/nerdtree' ""
Plug 'w0rp/ale' " autofix and linting
Plug 'Xuyuanp/nerdtree-git-plugin' " display files as modified from git in nerdtree
Plug 'junegunn/fzf.vim'
Plug 'yegappan/mru'
Plug 'scrooloose/nerdtree-project-plugin'
call plug#end()
colorscheme onedark
let g:airline#extensions#tabline#enabled = 1
autocmd vimenter * NERDTree
autocmd VimEnter * wincmd p

"closes nerdtree on last
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
set mouse=a
set autoread
set nu
set noswapfile
set nobackup
set nowb

let NERDTreeMouseMode=3
let g:ale_fixers = ['eslint']



let g:ale_fix_on_save = 1
set backspace=indent,eol,start " for some reason backspace doesn't work normally, wtf
set list
let g:EditorConfig_exclude_patterns = ['fugitive://.*']

@noscript
Copy link

noscript commented Aug 28, 2020

It looks like NERDTree window has to be focused to use this functionality. @scrooloose is it possible to e.g. fetch open directories without having NERDTree visible?

UPDATE: answering my own question:

let b_NERDTree = getbufvar(t:NERDTreeBufName, 'NERDTree')

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

No branches or pull requests

2 participants