Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Updating README - Post-Update Hook

Abierto
#1,013 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python, vim

Línea de trabajo

Empieza en el README, en el ejemplo del hook post-update de YouCompleteMe, y compara el comando actual de Vimscript con el error de Windows informado. Decide cuál de los hooks proporcionados gestiona la versión de Python conservando el uso en Unix y, después, verifica que el ejemplo del README se pueda copiar y pegar y documente el comportamiento compatible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

tip

Problem

For building YouCompleteMe, as seen in the README, it uses Unix notation and doesn't take into account the version of Python specific to Vim. I'm hoping updating the code might save some people time and a headache or two.

I supplied the current code in the README, along with a couple of other versions that I tested. They don't include version support for Linux, but I've never had any serious issues on Linux with Python and Vim.

From the context of the README, it looks to be a basic explanation on the concept, but I don't imagine anyone complaining about a couple of extra lines that people are probably copying and pasting (like I did).


Versions

Current Code

This is the specific error for the current code. Windows doesn't like the code being sent to it.

'.' is not recognized as an internal or external command,
operable program or batch file.
shell returned 1
function! BuildYCM(info)
  " info is a dictionary with 3 fields
  " - name:   name of the plugin
  " - status: 'installed', 'updated', or 'unchanged'
  " - force:  set on PlugInstall! or PlugUpdate!
  if a:info.status == 'installed' || a:info.force
    !./install.py
  endif
endfunction

Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
Enhanced VimScript

Successfully installs using the correct version of Python.
Should probably be updated for Linux as well.

function! BuildYCM(info)
  " info is a dictionary with 3 fields
  " - name:   name of the plugin
  " - status: 'installed', 'updated', or 'unchanged'
  " - force:  set on PlugInstall! or PlugUpdate!
  if a:info.status == 'installed' || a:info.force
    if has('win32')
      let py_version = py3eval('sys.version.split()[0].replace(".", "")')
      let py_version = py_version[:0] . '.' . py_version[1:]
      let command = printf('!py -%s %s', py_version, shellescape(expand('.\install.py')))
      execute(command)
    else
      !./install.py
    endif
  endif
endfunction

Plug 'ycm-core/YouCompleteMe',
 \ { 'do': function('BuildYCM') }
Python

Successfully installs the correct version on Windows.
It's a bit more verbose (mostly due to the docstring), but I think it's a lot easier to read for most people.

function! BuildYCM(info)
python3 << EOF
""" Post-Update Hook for YouCompleteMe using Vim-Plug.

Limitations
-----------
Only supports Windows and Linux

Arguments
---------
info : 3-dict
    name : str
        Name of the plugin.
    status : {'installed', 'updated', or 'unchanged'}
    force : bool
        Set to True on `PlugInstall!` or `PlugUpdate!`.

"""
from pathlib import Path


info = vim.eval('a:info')
if info['status'] == 'installed' or info['force']:

    py_version = sys.version.split()[0].replace('.', '')
    py_version = py_version[:1] + '.' + py_version[1:]
    os_specific = f'py -{py_version}' if sys.platform == 'win32' else ''
    command = f'!{os_specific} {Path("./install.py")}'

vim.command(command)
EOF
endfunction

Plug 'ycm-core/YouCompleteMe',
 \ { 'do': function('BuildYCM') }
Vimscript, but default Python version

Based on the original script, this solves the issue of Windows vs. Linux, but won't use the proper version.
This may not be an issue with python-x, but I'm not that savvy.

function! BuildYCM(info)
  " info is a dictionary with 3 fields
  " - name:   name of the plugin
  " - status: 'installed', 'updated', or 'unchanged'
  " - force:  set on PlugInstall! or PlugUpdate!
  if a:info.status == 'installed' || a:info.force
    execute('!' . shellescape(expand('./install.py')))
  endif
endfunction

Plug 'ycm-core/YouCompleteMe',
 \ { 'do': function('BuildYCM') }

Additional Information

Version Information
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 12 2019 13:30:17)
MS-Windows 32-bit GUI version with OLE support
Compiled by mool@tororo
Huge version with GUI.  Features included (+) or not (-):
+acl                +eval               +multi_lang         -tag_any_white
+arabic             +ex_extra           +mzscheme/dyn       +tcl/dyn
+autocmd            +extra_search       +netbeans_intg      -termguicolors
+autochdir          -farsi              +num64              +terminal
+autoservername     +file_in_path       +ole                -termresponse
+balloon_eval       +find_in_path       +packages           +textobjects
-balloon_eval_term  +float              +path_extra         +textprop
+browse             +folding            +perl/dyn           -tgetent
++builtin_terms     -footer             +persistent_undo    +timers
+byte_offset        +gettext/dyn        +popupwin           +title
+channel            -hangul_input       -postscript         +toolbar
+cindent            +iconv/dyn          +printer            +user_commands
+clientserver       +insert_expand      +profile            +vartabs
+clipboard          +job                +python/dyn         +vertsplit
+cmdline_compl      +jumplist           +python3/dyn        +virtualedit
+cmdline_hist       +keymap             +quickfix           +visual
+cmdline_info       +lambda             +reltime            +visualextra
+comments           +langmap            +rightleft          +viminfo
+conceal            +libcall            +ruby/dyn           +vreplace
+cryptv             +linebreak          +scrollbind         -vtp
+cscope             +lispindent         +signs              +wildignore
+cursorbind         +listcmds           +smartindent        +wildmenu
+cursorshape        +localmap           +sound              +windows
+dialog_con_gui     +lua/dyn            +spell              +writebackup
+diff               +menu               +startuptime        -xfontset
+digraphs           +mksession          +statusline         -xim
+directx            +modify_fname       -sun_workshop       +xpm_w32
-dnd                +mouse              +syntax             -xterm_save
-ebcdic             +mouseshape         +tag_binary         
+emacs_tags         +multi_byte_ime/dyn -tag_old_static     
   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 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /arch:IA32 /Zl /MT -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=\"python36.dll\" -DFEAT_MZSCHEME -I "E:\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=\"perl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=24 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby240.dll\" -DFEAT_HUGE /Fd.\ObjGXOULYHTRZi386/ /Zi
Linking: link  /nologo /opt:ref /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:i386 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib  /machine:i386  libcmt.lib oleaut32.lib user32.lib  /nodefaultlib:lua53.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python36.lib   "E:\ActiveTcl\lib\tclstub86.lib" winmm.lib WSock32.lib xpm\x86\lib-vc14\libXpm.lib /PDB:gvim.pdb -debug
  • Type:
    • Enhancement
  • OS:
    • Windows

Note: Please let me know if there's something I missed or if you know how to shorten the code for the Python version.

Lenguaje dominante
Vim Script
Estrellas
35.8k
Forks
1.9k
Merge medio
1 h
PR fusionados (30 d)
2

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de junegunn/vim-plug

Todos los issues de junegunn/vim-plug

Issues similares

Más issues de Documentation

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.