junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
34.1k stars 1.93k forks source link

Invalid URI : ^A #998

Open ordinary-slim opened 4 years ago

ordinary-slim commented 4 years ago

Actual problem: Can install my plugins no problem. Can not update them, their URI then becomes "^A". The error message:

Updated. Elapsed time: 7.956585 sec. [xxxxxxx]

Image: image

Tried PlugClean then PlugInstall again. Tried specifying the adresses of the github repositories with their SSH key instead.

Part of my vimrc:

`if has('win32')
    set shell=powershell
endif
" Pluggins. Plug manager is vim-plug
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let g:vim_plug_path = $HOME.'/.vim/autoload/plug.vim'
let &rtp .= g:vim_plug_path

let g:vim_plug_installed = 1
" if vim-plug is not installed, install vim-plug
if empty(glob(g:vim_plug_path))
    if executable('curl')
        silent exec '!curl -fLo '.g:vim_plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
        autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
    elseif executable('wget')
        silent exec '!wget "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" -P '.fnamemodify(g:vim_plug_path, ":h")
        autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
    else
        echo '! Could not install the plugin manager :('
        let g:vim_plug_installed = 0
    endif
endif
if g:vim_plug_installed

    exec 'source '.g:vim_plug_path
    call plug#begin('~/.vim/plugged')
    " Utility
    Plug 'MarcWeber/vim-addon-mw-utils' "required by snipmate
    Plug 'tomtom/tlib_vim' "required by snipmate
    Plug 'garbas/vim-snipmate' "snippets
    Plug 'skywind3000/asyncrun.vim' "job_start made easier
    " Coding
    Plug 'vim-syntastic/syntastic' "syntax checks for a lot of languages
    " Aspect
    Plug 'morhetz/gruvbox' " gruvbox colorscheme
    " Miscellaneous
    Plug 'terryma/vim-smooth-scroll' " smooth scrolling
        noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
        noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
        noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
        noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
    call plug#end()

endif

Contents of version: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 14 2020 22:02:32) MS-Windows 64-bit GUI version with OLE support Included patches: 1-579 Compiled by appveyor@APPVYR-WIN Huge version with GUI. Features included (+) or not (-): +acl +cmdline_hist +eval +jumplist +multi_byte_ime/dyn +python3/dyn -tag_old_static +virtualedit +arabic +cmdline_info +ex_extra +keymap +multi_lang +quickfix -tag_any_white +visual +autocmd +comments +extra_search +lambda +mzscheme/dyn +reltime +tcl/dyn +visualextra +autochdir +conceal -farsi +langmap +netbeans_intg +rightleft -termguicolors +viminfo +autoservername +cryptv +file_in_path +libcall +num64 +ruby/dyn +terminal +vreplace +balloon_eval +cscope +find_in_path +linebreak +ole +scrollbind -termresponse -vtp -balloon_eval_term +cursorbind +float +lispindent +packages +signs +textobjects +wildignore +browse +cursorshape +folding +listcmds +path_extra +smartindent +textprop +wildmenu ++builtin_terms +dialog_con_gui -footer +localmap +perl/dyn +sound -tgetent +windows +byte_offset +diff +gettext/dyn +lua/dyn +persistent_undo +spell +timers +writebackup +channel +digraphs -hangul_input +menu +popupwin +startuptime +title -xfontset +cindent +directx +iconv/dyn +mksession -postscript +statusline +toolbar -xim +clientserver -dnd +insert_expand +modify_fname +printer -sun_workshop +user_commands +xpm_w32 +clipboard -ebcdic -ipv6 +mouse +profile +syntax +vartabs -xterm_save +cmdline_compl +emacs_tags +job +mouseshape +python/dyn +tag_binary +vertsplit
system vimrc file: "$VIM\vimrc" user vimrc file: "$HOME_vimrc" 2nd user vimrc file: "$HOME\vimfiles\vimrc" 3rd user vimrc file: "$VIM_vimrc" user exrc file: "$HOME_exrc" 2nd user exrc file: "$VIM_exrc" system gvimrc file: "$VIM\gvimrc" user gvimrc file: "$HOME_gvimrc" 2nd user gvimrc file: "$HOME\vimfiles\gvimrc" 3rd user gvimrc file: "$VIM_gvimrc" defaults file: "$VIMRUNTIME\defaults.vim" system menu file: "$VIMRUNTIME\menu.vim" Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_XPM_W32 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /source-charset:utf-8 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /Zl /MT /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86t.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python38.dll\" -DFEAT_MZSCHEME -I "C:\Program Files\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_a36fs8.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_a36fs8.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl528.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby240.dll\" -DRUBY_VERSION=24 -DFEAT_HUGE /Fd.\ObjGXOULYHTRZAMD64/ /Zi Linking: link /nologo /opt:ref /LTCG:STATUS /HIGHENTROPYVA:NO oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib /machine:AMD64 libcmt.lib oleaut32.lib user32.lib /nodefaultlib:lua53.lib /STACK:8388608 /nodefaultlib:python27.lib /nodefaultlib:python38.lib "C:\Tcl\lib\tclstub86.lib" winmm.lib WSock32.lib Ws2_32.lib xpm\x64\lib-vc14\libXpm.lib /PDB:gvim.pdb -debug

janlazo commented 4 years ago

Your vimrc is insufficient if you're setting the shell to powershell. I need the full list of your shell options.

Here is a snippet from my vimrc:

      let &shellcmdflag = '-NoProfile -NoLogo -ExecutionPolicy RemoteSigned -Command'
      if has('win32') || has('win32unix')
        let &shellcmdflag = ' ' . &shellcmdflag
      endif
      set shellxescape= shellquote= noshellslash
      let &shellredir = '| Out-File -Encoding UTF8'
      if has('quickfix')
        let &shellpipe = '|'
      endif

      if has('nvim')
        set shellxquote=
      else
        let &shellxquote = has('win32') ? '"' : ''
      endif

https://github.com/janlazo/dotvim8/blob/344e894c93b1875c36ad678b2dc37fc172122b2b/shared.vim#L189-L204

ordinary-slim commented 4 years ago

Your vimrc is insufficient if you're setting the shell to powershell. I need the full list of your shell options.

Here is a snippet from my vimrc:

      let &shellcmdflag = '-NoProfile -NoLogo -ExecutionPolicy RemoteSigned -Command'
      if has('win32') || has('win32unix')
        let &shellcmdflag = ' ' . &shellcmdflag
      endif
      set shellxescape= shellquote= noshellslash
      let &shellredir = '| Out-File -Encoding UTF8'
      if has('quickfix')
        let &shellpipe = '|'
      endif

      if has('nvim')
        set shellxquote=
      else
        let &shellxquote = has('win32') ? '"' : ''
      endif

https://github.com/janlazo/dotvim8/blob/344e894c93b1875c36ad678b2dc37fc172122b2b/shared.vim#L189-L204

That that you can see are my only shell options, see for yourself (link to my .vimrc):

Could you tell me what am I lacking please?

janlazo commented 4 years ago

Did you try to copy/paste my shell options for powershell into your vimrc?

Vim/Neovim do not auto-configure its shell options when shell is set to a different value. You have to set them all else unexpected issues may occur. vim-plug respects the user's shell but vim-plug depends on the user to set the shell options correctly. It does not use the user's shell for some commands that can be executed directly such as installing plugins.

ordinary-slim commented 4 years ago

This is what I've tried:

PS : Sorry for the late response. I'll do some settings digging during the week-end and update this comment.

janlazo commented 4 years ago

If you take out -Encoding UTF8 or change the value into something else, what happens? Can you include the powershell version? Value of $PSVersionTable.PSVersion will do. What's the value of the encoding Vim option?

ordinary-slim commented 4 years ago

If you take out -Encoding UTF8 or change the value into something else, what happens? Can you include the powershell version? Value of $PSVersionTable.PSVersion will do. What's the value of the encoding Vim option?

janlazo commented 4 years ago

Oh no. encoding should be set to utf-8 on Windows, especially when using Powershell. I do it in https://github.com/janlazo/dotvim8/commit/8f179c02b806a389de2bc0a94cc1ef3f4a1e0768#diff-076d61938d25fd036d6436c94d8778faR16-R20

ordinary-slim commented 4 years ago

The minimal fix is to set shellxquote= i.e. set shellxquote to nothing. By default, it is set to " . This does not combine very well with the vim system function. For instance, both echo system("echo hello") and echo system("echo \"hello\"") give: image I think this is the same problem that this stackexchange user encountered.

In summary, changing the default setting of shellxquote to nothing instead of " fixes the problem.

janlazo commented 4 years ago

That's not a fix. There should be no ^A even in that trivial case. I suspect wrong encoding settings either on gvim or in your console codepage via chcp. shellxquote is set to " on Windows because Vim runs it through cmd.exe and cmd.exe uses " for escaping arguments. Powershell arguments should be escaped via single quotes.

Neovim does not have the same limitation so I set shellxquote to an empty string in my vimrc.

If you really want to use powershell, use neovim or run powershell core on a Unix-like system or upgrade your powershell to version that can output in UTF-8 strings. Powershell output encoding defaults to utf-16 which does not work well on Vim.