Mercurial > vim
comparison src/option.c @ 10722:7598ce51bf2a v8.0.0251
patch 8.0.0251: not easy to select Python 2 or 3
commit https://github.com/vim/vim/commit/f42dd3c3901ea0ba38e67a616aea9953cae81b8d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 28 16:06:38 2017 +0100
patch 8.0.0251: not easy to select Python 2 or 3
Problem: It is not so easy to write a script that works with both Python 2
and Python 3, even when the Python code works with both.
Solution: Add 'pyxversion', :pyx, etc. (Marc Weber, Ken Takata)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 28 Jan 2017 16:15:04 +0100 |
parents | 4940a195bd1f |
children | 4dea7c96fc82 |
comparison
equal
deleted
inserted
replaced
10721:9177c4f6a229 | 10722:7598ce51bf2a |
---|---|
477 # define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn" | 477 # define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn" |
478 #else | 478 #else |
479 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" | 479 # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" |
480 #endif | 480 #endif |
481 | 481 |
482 /* Default python version for pyx* commands */ | |
483 #if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) | |
484 # define DEFAULT_PYTHON_VER 0 | |
485 #elif defined(FEAT_PYTHON3) | |
486 # define DEFAULT_PYTHON_VER 3 | |
487 #elif defined(FEAT_PYTHON) | |
488 # define DEFAULT_PYTHON_VER 2 | |
489 #else | |
490 # define DEFAULT_PYTHON_VER 0 | |
491 #endif | |
492 | |
482 /* | 493 /* |
483 * options[] is initialized here. | 494 * options[] is initialized here. |
484 * The order of the options MUST be alphabetic for ":set all" and findoption(). | 495 * The order of the options MUST be alphabetic for ":set all" and findoption(). |
485 * All option names MUST start with a lowercase letter (for findoption()). | 496 * All option names MUST start with a lowercase letter (for findoption()). |
486 * Exception: "t_" options are at the end. | 497 * Exception: "t_" options are at the end. |
2141 {"pythondll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, | 2152 {"pythondll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, |
2142 (char_u *)&p_pydll, PV_NONE, | 2153 (char_u *)&p_pydll, PV_NONE, |
2143 {(char_u *)DYNAMIC_PYTHON_DLL, (char_u *)0L} | 2154 {(char_u *)DYNAMIC_PYTHON_DLL, (char_u *)0L} |
2144 SCRIPTID_INIT}, | 2155 SCRIPTID_INIT}, |
2145 #endif | 2156 #endif |
2157 {"pyxversion", "pyx", P_NUM|P_VI_DEF|P_SECURE, | |
2158 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) | |
2159 (char_u *)&p_pyx, PV_NONE, | |
2160 #else | |
2161 (char_u *)NULL, PV_NONE, | |
2162 #endif | |
2163 {(char_u *)DEFAULT_PYTHON_VER, (char_u *)0L} | |
2164 SCRIPTID_INIT}, | |
2146 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, | 2165 {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, |
2147 #ifdef FEAT_TEXTOBJ | 2166 #ifdef FEAT_TEXTOBJ |
2148 (char_u *)&p_qe, PV_QE, | 2167 (char_u *)&p_qe, PV_QE, |
2149 {(char_u *)"\\", (char_u *)0L} | 2168 {(char_u *)"\\", (char_u *)0L} |
2150 #else | 2169 #else |
8824 #ifdef MZSCHEME_GUI_THREADS | 8843 #ifdef MZSCHEME_GUI_THREADS |
8825 else if (pp == &p_mzq) | 8844 else if (pp == &p_mzq) |
8826 mzvim_reset_timer(); | 8845 mzvim_reset_timer(); |
8827 #endif | 8846 #endif |
8828 | 8847 |
8848 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) | |
8849 /* 'pyxversion' */ | |
8850 else if (pp == &p_pyx) | |
8851 { | |
8852 if (p_pyx != 0 && p_pyx != 2 && p_pyx != 3) | |
8853 errmsg = e_invarg; | |
8854 } | |
8855 #endif | |
8856 | |
8829 /* sync undo before 'undolevels' changes */ | 8857 /* sync undo before 'undolevels' changes */ |
8830 else if (pp == &p_ul) | 8858 else if (pp == &p_ul) |
8831 { | 8859 { |
8832 /* use the old value, otherwise u_sync() may not work properly */ | 8860 /* use the old value, otherwise u_sync() may not work properly */ |
8833 p_ul = old_value; | 8861 p_ul = old_value; |