Shougo / dein.vim

:zap: Dark powered Vim/Neovim plugin manager
MIT License
3.42k stars 197 forks source link

README setup example fails with errors #511

Closed HaleTom closed 1 year ago

HaleTom commented 1 year ago

Description

Using the example in the README:

let $CACHE = expand('~/.cache')
if !($CACHE->isdirectory())
  call mkdir($CACHE, 'p')
endif
if &runtimepath !~# '/dein.vim'
  let s:dir = 'dein.vim'->fnamemodify(':p')
  if !(s:dir->isdirectory())
    let s:dir = $CACHE .. '/dein/repos/github.com/Shougo/dein.vim'
    if !(s:dir->isdirectory())
      execute '!git clone https://github.com/Shougo/dein.vim' s:dir
    endif
  endif
  execute 'set runtimepath^=' .. s:dir->fnamemodify(':p')->
      \ substitute('[/\\]$', '', '')
endif

I get the following error:

Error detected while processing /home/var/ravi/tmp/dein/example:
line   13:
E15: Invalid expression:  substitute('[/\\]$', '', '')
E260: Missing name after ->
Press ENTER or type command to continue

Expected behavior

nvim loads without error

Desktop:

Shougo commented 1 year ago

Fixed the example. please fix.

  execute 'set runtimepath^=' .. s:dir
      \ ->fnamemodify(':p')->substitute('[/\\]$', '', '')

is correct.