Skip to content

Commit 95ff699

Browse files
authored
Merge pull request #252 from mnishz/if_pyth_for_Vim_8.1
Update if_pyth from Vim 8.0 to 8.1
2 parents 8a5b558 + 94c082d commit 95ff699

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

doc/if_pyth.jax

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*if_pyth.txt* For Vim バージョン 8.0. Last change: 2017 Mar 09
1+
*if_pyth.txt* For Vim バージョン 8.1. Last change: 2018 Jan 30
22

33

44
VIMリファレンスマニュアル by Paul Moore
@@ -703,6 +703,8 @@ vim.Function オブジェクト *python-Function*
703703
使って Python の式を評価して、その値を Vim script に渡すことができます。
704704
|pyxeval()| も使用可能です。
705705

706+
Python での "None" は v:none に変換されます。
707+
706708
==============================================================================
707709
9. 動的ローディング *python-dynamic*
708710

@@ -724,7 +726,7 @@ WindowsでPythonインターフェイスを使うには、PythonのDLLが検索
724726

725727
DLLの名前はVimをコンパイルした時のPythonのバージョンに一致しなければなりませ
726728
ん。現在その名前は "python27.dll" です。これはPython 2.7用です。これは
727-
'pythondll' の既定値です。Python 3の場合はpython35.dll (Python3.5)です。これを
729+
'pythondll' の既定値です。Python 3の場合はpython36.dll (Python3.6)です。これを
728730
確かめるには、"gvim.exe" を開き、"python\d*.dll\c" を検索してください。
729731

730732

@@ -797,7 +799,8 @@ Python 内で SystemExit 例外を発生させても Vim は終了しない。
797799
>
798800
if has('python')
799801
echo 'there is Python 2.x'
800-
elseif has('python3')
802+
endif
803+
if has('python3')
801804
echo 'there is Python 3.x'
802805
endif
803806
@@ -806,6 +809,24 @@ Note: Python の 2 と 3 の両方が利用可能で、Python が動的ロード
806809
ロードできるのがどちらか一方だけだった場合、Python の 2 と 3 のどちらが利用で
807810
きるか調べるだけで、もう一方は利用できなくなります。
808811

812+
この動的ライブラリのローディングを防ぐためには、単に Vim が Python をサポート
813+
した状態でコンパイルされているかどうかを確認します: >
814+
if has('python_compiled')
815+
echo 'compiled with Python 2.x support'
816+
if has('python_dynamic')
817+
echo 'Python 2.x dynamically loaded'
818+
endif
819+
endif
820+
if has('python3_compiled')
821+
echo 'compiled with Python 3.x support'
822+
if has('python3_dynamic')
823+
echo 'Python 3.x dynamically loaded'
824+
endif
825+
endif
826+
827+
実行時ライブラリが見つからなかった場合は Python の動的ローディングは失敗します
828+
が、このコードは正しくロードされたかどうかを表示することにもなります。
829+
809830
==============================================================================
810831
11. Python X *python_x* *pythonx*
811832

en/if_pyth.txt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*if_pyth.txt* For Vim version 8.0. Last change: 2017 Mar 09
1+
*if_pyth.txt* For Vim version 8.1. Last change: 2018 Jan 30
22

33

44
VIM REFERENCE MANUAL by Paul Moore
@@ -715,6 +715,8 @@ To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
715715
functions to evaluate Python expressions and pass their values to Vim script.
716716
|pyxeval()| is also available.
717717

718+
The Python value "None" is converted to v:none.
719+
718720
==============================================================================
719721
9. Dynamic loading *python-dynamic*
720722

@@ -734,8 +736,8 @@ or 'pythonthreedll' option can be also used to specify the Python DLL.
734736

735737
The name of the DLL should match the Python version Vim was compiled with.
736738
Currently the name for Python 2 is "python27.dll", that is for Python 2.7.
737-
That is the default value for 'pythondll'. For Python 3 it is python35.dll
738-
(Python 3.5). To know for sure edit "gvim.exe" and search for
739+
That is the default value for 'pythondll'. For Python 3 it is python36.dll
740+
(Python 3.6). To know for sure edit "gvim.exe" and search for
739741
"python\d*.dll\c".
740742

741743

@@ -807,7 +809,8 @@ Raising SystemExit exception in python isn't endorsed way to quit vim, use: >
807809
You can test what Python version is available with: >
808810
if has('python')
809811
echo 'there is Python 2.x'
810-
elseif has('python3')
812+
endif
813+
if has('python3')
811814
echo 'there is Python 3.x'
812815
endif
813816
@@ -816,6 +819,24 @@ dynamically, these has() calls will try to load them. If only one can be
816819
loaded at a time, just checking if Python 2 or 3 are available will prevent
817820
the other one from being available.
818821

822+
To avoid loading the dynamic library, only check if Vim was compiled with
823+
python support: >
824+
if has('python_compiled')
825+
echo 'compiled with Python 2.x support'
826+
if has('python_dynamic')
827+
echo 'Python 2.x dynamically loaded'
828+
endif
829+
endif
830+
if has('python3_compiled')
831+
echo 'compiled with Python 3.x support'
832+
if has('python3_dynamic')
833+
echo 'Python 3.x dynamically loaded'
834+
endif
835+
endif
836+
837+
This also tells you whether Python is dynamically loaded, which will fail if
838+
the runtime library cannot be found.
839+
819840
==============================================================================
820841
11. Python X *python_x* *pythonx*
821842

@@ -894,10 +915,10 @@ On Ubuntu you will want to install these packages for Python 2:
894915
python-dev
895916
For Python 3:
896917
python3
897-
pytyon3-dev
918+
python3-dev
898919
For Python 3.6:
899920
python3.6
900-
pytyon3.6-dev
921+
python3.6-dev
901922

902923
If you have more than one version of Python 3, you need to link python3 to the
903924
one you prefer, before running configure.

0 commit comments

Comments
 (0)