carlhuda / janus

Vim distribution
7.88k stars 814 forks source link

Windows - error E172 while processing .vimrc (spaces not escaped) #685

Closed diogotito closed 7 years ago

diogotito commented 7 years ago

When I ran vim, right after installing Janus in a MSYS2 environment, I got the following errors:

Diogo Tito Marques@Portatil-Win10 MSYS ~
$ vim .vimrc
Error detected while processing /home/Diogo Tito Marques/.vimrc:
line   17:
E172: Only one file name allowed: source /home/Diogo Tito Marques/.vim/janus/vim/core/before/plugin/janus.vim
(...)
line   35:
E172: Only one file name allowed: source /home/Diogo Tito Marques/.vim/janus/vim/core/plugins.vim
line   42:
E117: Unknown function: janus#load_pathogen
Press ENTER or type command to continue

The problem seems to be that the spaces I put in my Windows username aren't being escaped in lines 7-8 in the default .vimrc provided by Janus

  5  " Define paths
  6  if has('win32') || has('win64') || has('win32unix')
  7    let g:janus_path = expand("~/.vim/janus/vim")
  8    let g:janus_vim_path = expand("~/.vim/janus/vim")
  9  else
 10    let g:janus_path = escape(fnamemodify(resolve(expand("<sfile>:p")), ":h")>
 11    let g:janus_vim_path = escape(fnamemodify(resolve(expand("<sfile>:p" . "v>
 12  endif
 13  let g:janus_custom_path = expand("~/.janus")
 14 
 15  " Source janus's core
 16  exe 'source ' . g:janus_vim_path . '/core/before/plugin/janus.vim'

Apparently, these unescaped spaces mess with the commands generated in lines 16 and 34, which throw those errors

I tried to wrap these expand calls inside an escape

   let g:janus_path = escape(expand("~/.vim/janus/vim"), ' ')
   let g:janus_vim_path = escape(expand("~/.vim/janus/vim"), ' ')

And it worked for me.

I'm running vim 8.0.0124-1 from MSYS2 (msys2-x86_64-20161025) on Windows 10 (build 14393).

kalbasit commented 7 years ago

Please file a PR to fix it. Thank you.