preservim / nerdtree

A tree explorer plugin for vim.
Do What The F*ck You Want To Public License
19.52k stars 1.44k forks source link

Error with the latest version #911

Closed dejavuwow closed 5 years ago

dejavuwow commented 5 years ago

I updated the plugin just now. but it doesn't work😫 when vim start up,the plugin throw an error like this image the variable g:NERDtreeNodeDelimiter is not defined at nerdtree.vim. And it causes vim doesn't work now.

PhilRunninger commented 5 years ago

What is the output of the :scriptnames command?

dejavuwow commented 5 years ago

What is the output of the :scriptnames command?

I can't do any opration since the error throw. vim doesn't respond to me.

PhilRunninger commented 5 years ago

If you have something in your vimrc that automatically launches NERDTree, remove that first, and then run :scriptnames. If you can share your vimrc, that would help too.

dejavuwow commented 5 years ago

If you have something in your vimrc that automatically launches NERDTree, remove that first, and then run :scriptnames. If you can share your vimrc, that would help too.

set fileencodings=utf-8,ucs-bom,cp936,big5 set fileencoding=utf-8 set nocompatible filetype off set rtp+=$VIM/vimfiles/bundle/vundle/ call vundle#begin('$VIM/vimfiles/bundle/') "插件列表" Bundle 'gmarik/vundle' Bundle 'matrix.vim'
Bundle 'closetag.vim'
Bundle 'The-NERD-Commenter'
Bundle 'AutoComplPop'
Bundle 'altercation/vim-colors-solarized' Plugin 'jistr/vim-nerdtree-tabs' Plugin 'scrooloose/nerdtree' Plugin 'https://github.com/yegappan/mru.git' Plugin 'https://github.com/mattn/emmet-vim.git' Plugin 'https://github.com/vim-scripts/matchit.zip.git' Plugin 'posva/vim-vue' Plugin 'scrooloose/nerdcommenter' Plugin 'vim-misc' Plugin 'https://github.com/xolox/vim-session.git' call vundle#end()
filetype plugin indent on

set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif let arg1 = substitute(arg1, '!', '!', 'g') let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif let arg2 = substitute(arg2, '!', '!', 'g') let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif let arg3 = substitute(arg3, '!', '!', 'g') if $VIMRUNTIME =~ ' ' if &sh =~ '\<cmd' if empty(&shellxquote) let l:shxq_sav = '' set shellxquote& endif let cmd = '"' . $VIMRUNTIME . '\diff"' else let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' endif else let cmd = $VIMRUNTIME . '\diff' endif let cmd = substitute(cmd, '!', '!', 'g') silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 if exists('l:shxq_sav') let &shellxquote=l:shxq_sav endif endfunction

"个人配置" set shortmess=atl set number filetype on set autoindent set smartindent set showmatch set vb t_vb= set ruler set cursorline set incsearch set cul set tabstop=4 set shiftwidth=4 set autoindent set laststatus=2 set display=lastline set ruler set autochdir set guifont=Source_Code_Pro:h11 set hlsearch syntax enable set background=light colorscheme solarized set t_Co=256 let g:solarized_termcolors=256 set clipboard=unnamed "注释" " Add spaces after comment delimiters by default let g:NERDSpaceDelims = 1

" Use compact syntax for prettified multi-line comments let g:NERDCompactSexyComs = 1

" Align line-wise comment delimiters flush left instead of following code indentation let g:NERDDefaultAlign = 'left'

" Set a language to use its alternate delimiters by default let g:NERDAltDelims_java = 1

" Add your own custom formats or override the defaults let g:NERDCustomDelimiters = { 'c': { 'left': '/*','right': '/' } }

" Allow commenting and inverting empty lines (useful when commenting a region) let g:NERDCommentEmptyLines = 1

" Enable trimming of trailing whitespace when uncommenting let g:NERDTrimTrailingWhitespace = 1

" Enable NERDCommenterToggle to check all selected lines is commented or not let g:NERDToggleCheckAllLines = 1

"括号自动补齐" inoremap ( ()i inoremap [ []i inoremap { {}i inoremap < <>i autocmd Syntax html,vim inoremap < >i| inoremap > =ClosePair('>') inoremap ) =ClosePair(')') inoremap ] =ClosePair(']') inoremap } =CloseBracket() inoremap > =ClosePair('>') inoremap " =QuoteDelim('"') inoremap ' =QuoteDelim("'")

set nocompatible set backspace=indent,eol,start let b:match_words='\<begin>:\<\end>'

function ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\" else return a:char endif endf

function CloseBracket() if match(getline(line('.') + 1), '\s*}') < 0 return "\}" else return "\j0f}a" endif endf

function QuoteDelim(char) let line = getline('.') let col = col('.') if line[col - 2] == "\" return a:char elseif line[col - 1] == a:char return "\" else return a:char.a:char."\i" endif endf

"emmet配置" let g:user_emmet_mode='n'
let g:user_emmet_mode='inv'
let g:user_emmet_mode='a'
let g:user_emmet_install_global = 0 autocmd FileType html,css,vue EmmetInstall autocmd FileType vue syntax sync fromstart autocmd BufRead,BufNewFile *.vue set filetype=vue let g:vue_disable_pre_processors=1 "css" autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS "目录树" nmap :NERDTree " NERDTree.vim" map t :NERDTreeToggle let NERDTreeShowLineNumbers=1 let NERDTreeAutoCenter=1 let NERDTreeShowHidden=1 let NERDTreeWinSize=31 let g:nerdtree_tabs_open_on_console_startup=1 let NERDTreeIgnore=['.pyc','\~$','.swp'] let NERDTreeShowBookmarks=1

"解决菜单乱码" source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim "解决consle输出乱码" language messages zh_CN.utf-8 autocmd GUIEnter * simalt ~x

"会话保存功能" set sessionoptions=blank,buffers,curdir,folds,tabpages,winsize let g:session_autosave = 'yes' let g:session_autoload = 'yes'

let MRU_Max_Menu_Entries = 20 let MRU_Auto_Close = 0 let MRU_File = 'F:\Vim\vimfiles\session_vim_mru_files' "au VimLeave mks! $VIM/vimfiles/session/Session.vim" autocmd BufReadPost \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif exec 'cd ' . fnameescape('d:\')

PhilRunninger commented 5 years ago

What happens if you put this in your vimrc?

let g:NERDTreeNodeDelimiter = "\u00a0"

At this point in the diagnosis, it's a workaround, but let's see if it solves anything.

dejavuwow commented 5 years ago

What happens if you put this in your vimrc?

let g:NERDTreeNodeDelimiter = "\u00a0"

At this point in the diagnosis, it's a workaround, but let's see if it solves anything.

image throw error: cant't find separator in line 41

PhilRunninger commented 5 years ago

I wonder if it's the encoding that you're using. Instead of \u00a0 use some other character that you won't find in filenames. This variable is used to separate the filename from the rest of the characters on the line of text.

dejavuwow commented 5 years ago

I wonder if it's the encoding that you're using. Instead of \u00a0 use some other character that you won't find in filenames. This variable is used to separate the filename from the rest of the characters on the line of text.

well,I tried let g:NERDTreeNodeDelimiter = " " it worked unexpectedly!

dejavuwow commented 5 years ago

emm...it seems to cause another proplem. i can't open the folder,command output: NERDTree: cannot close tree root

PhilRunninger commented 5 years ago

The idea behind the latest change (and the \u00a0 character) is to have a better way to get the filename from the line of text in NERDTree. Other things that it needs to remove are the arrow heads, spaces, square brackets, bookmark indicators, symlink indicators, and flags that other plugins may introduce. There is a lot of text to sift through. We were getting reports that people couldn't open files with uncommon characters in them, files like:

foo[bar].txt
 leading_space_filename.txt
trailing_asterisk_filename*
curly{braces}.txt

and so on.

So I decided to use a \u00a0 (non-breaking space) to separate the filename (with whatever characters it has) from the rest of the text. That appears to be a bad choice for your setup. A space won't work either, because they are used to indent the files. Try some other obscure character, and see if that helps.

dejavuwow commented 5 years ago

The idea behind the latest change (and the \u00a0 character) is to have a better way to get the filename from the line of text in NERDTree. Other things that it needs to remove are the arrow heads, spaces, square brackets, bookmark indicators, symlink indicators, and flags that other plugins may introduce. There is a lot of text to sift through. We were getting reports that people couldn't open files with uncommon characters in them, files like:

foo[bar].txt
 leading_space_filename.txt
trailing_asterisk_filename*
curly{braces}.txt

and so on.

So I decided to use a \u00a0 (non-breaking space) to separate the filename (with whatever characters it has) from the rest of the text. That appears to be a bad choice for your setup. A space won't work either, because they are used to indent the files. Try some other obscure character, and see if that helps.

ok,I tried use tab character. It has been resolved. thanks very much!❤