Updating README - Post-Update Hook
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python, vim
- Ambito
- documentation
Direzione di ricerca
Inizia nel README, nell'esempio dell'hook post-update di YouCompleteMe, e confronta il comando Vimscript attuale con l'errore Windows segnalato. Decidi quale degli hook forniti gestisce la versione di Python mantenendo l'utilizzo su Unix, quindi verifica che l'esempio nel README possa essere copiato e incollato e documenti il comportamento supportato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Vim Script
- Stelle
- 35.8k
- Fork
- 1.9k
- Merge medio
- 1h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di junegunn/vim-plug
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 59/100
Tutte le issue di junegunn/vim-plug
Issue simili
-
agent-butler-finding chore
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
jordansmall/spindrift#6318 ·
I maintainer di solito rispondono entro 1 giorno
-
🎉 Add PandaPalAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
jaywcjlove/awesome-mac#4192 ·
I maintainer di solito rispondono entro 1 giorno
-
docs(harness-config): drop the last /review:audit-enforceability reference from an eval sampleApertaagent-ready priority: medium status: ready work-class: scoped
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
melodic-software/claude-code-plugins#12762 ·
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Перевод устарел
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100