@@ -807,61 +807,64 @@ Note: Python の 2 と 3 の両方が利用可能で、Python が動的ロード
807
807
==============================================================================
808
808
11. Python X *python_x* *pythonx*
809
809
810
- Because most python code can be written so that it works with python 2.6+ and
811
- python 3 the pyx* functions and commands have been writen. They work exactly
812
- the same as the Python 2 and 3 variants, but select the Python version using
813
- the 'pyxversion' setting.
810
+ 多くの python コードは、 python 2.6+ と python 3 に両方で動くことができるように
811
+ 書けるため、 pyx* 関数とコマンドが用意されました。それらは、Python 2 や 3 向け
812
+ の変種とまったく同じように動作しますが、 'pyxversion' 設定を用いて Python のバー
813
+ ジョンを選択できる点が異なります。
814
814
815
- You should set 'pyxversion' in your | .vimrc | to prefer Python 2 or Python 3
816
- for Python commands. If you change this setting at runtime you may risk that
817
- state of plugins (such as initialization) may be lost.
815
+ Python コマンドに Python 2 と 3 のどちらを使いたいかに応じて、 | .vimrc | の中で
816
+ 'pyxversion' を設定してください。もしこの設定を実行時に変更すると、プラグイン
817
+ の状態(例えば初期化など)が失われる危険性があります。
818
818
819
- If you want to use a module, you can put it in the {rtp} /pythonx directory.
820
- See | pythonx-directory | .
819
+ モジュールを使用したい場合には、 {rtp} /pythonx ディレクトリの中に置くことができ
820
+ ます。 | pythonx-directory | を参照してください。
821
821
822
822
*:pyx* *:pythonx*
823
- The `:pyx ` and `:pythonx ` commands work similar to `:python ` . A simple check
824
- if the `: pyx ` command is working : >
823
+ `:pyx ` コマンドと `:pythonx ` コマンドは `:python ` と同様に機能します。 `: pyx `
824
+ コマンドが機能するか簡単にチェックするには : >
825
825
:pyx print("Hello")
826
826
827
- To see what version of Python is being used : >
827
+ 使っている Python のバージョンを見るには : >
828
828
:pyx import sys
829
829
:pyx print(sys.version)
830
830
<
831
831
*:pyxfile* *python_x-special-comments*
832
- The `:pyxfile ` command works similar to `:pyfile ` . However you can add one of
833
- these comments to force Vim using `:pyfile ` or `:py3file ` : >
834
- #!/any string/python2 " Shebang. Must be the first line of the file.
835
- #!/any string/python3 " Shebang. Must be the first line of the file.
836
- # requires python 2.x " Maximum lines depend on 'modelines'.
837
- # requires python 3.x " Maximum lines depend on 'modelines'.
838
- Unlike normal modelines, the bottom of the file is not checked.
839
- If none of them are found, the 'pyxversion' setting is used.
832
+ `:pyxfile ` コマンドは `:pyfile ` と同様に機能します。しかし、Vim が `:pyfile `
833
+ または `:py3file ` を使うように強制したい場合は以下のコメントのうち 1 つを追加
834
+ することができます: >
835
+ #!/any string/python2 " Shebang。ファイルの先頭でなければならない。
836
+ #!/any string/python3 " Shebang。ファイルの先頭でなければならない。
837
+ # requires python 2.x " 最大行数は 'modelines' に依存。
838
+ # requires python 3.x " 最大行数は 'modelines' に依存。
839
+ 通常のモードラインとは異なり、ファイルの末尾はチェックされません。
840
+ いずれのコメントも見つからない場合は、'pyxversion' の設定が使われます。
840
841
*W20* *W21*
841
- If Vim does not support the selected Python version a silent message will be
842
- printed. Use `:messages ` to read them.
842
+ もし Vim が指定された Python のバージョンをサポートしない場合、静かなメッセー
843
+ ジが表示されます。それらを読むには `:messages ` を使用してください。
843
844
844
845
*:pyxdo*
845
- The `:pyxdo ` command works similar to `:pydo ` .
846
+ `:pyxdo ` コマンドは `:pydo ` と同様に機能します。
846
847
847
848
*has-pythonx*
848
- You can test if pyx* commands are available with : >
849
+ pyx* コマンドが使用できるかどうかを調べるには以下が使えます : >
849
850
if has('pythonx')
850
851
echo 'pyx* commands are available. (Python ' . &pyx . ')'
851
852
endif
852
853
853
- When compiled with only one of | +python | or | +python3 | , the has() returns 1.
854
- When compiled with both | +python | and | +python3 | , the test depends on the
855
- 'pyxversion' setting. If 'pyxversion' is 0, it tests Python 3 first, and if
856
- it is not available then Python 2. If 'pyxversion' is 2 or 3, it tests only
857
- Python 2 or 3 respectively.
854
+ | +python | または | +python3 | のどちらか一方のみでコンパイルされている場合は、
855
+ has() は 1 を返します。
856
+ | +python | と | +python3 | の両方でコンパイルされている場合は、テストは
857
+ 'pyxversion' の設定に依存します。もし 'pyxversion' が 0 ならば最初に Python 3
858
+ がテストされ、使用可能でなければ Python 2 がテストされます。もし 'pyxversion'
859
+ が 2 または 3 であれば、Python 2 または 3 のそれぞれどちらか一方のみをテストし
860
+ ます。
858
861
859
- Note that for has('pythonx' ) to work it may try to dynamically load Python 3
860
- or 2. This may have side effects, especially when Vim can only load one of
861
- the two.
862
+ has('pythonx' ) は動作のため、Python 3 または 2 を動的にロードしようとすること
863
+ がある点に注意してください。これは特に Vim が 2 つのうち 1 つしかロードできな
864
+ い場合に副作用があります。
862
865
863
- If a user prefers Python 2 and want to fallback to Python 3, he needs to set
864
- 'pyxversion' explicitly in his | .vimrc | . E.g. : >
866
+ もしもユーザーが Python 2 を優先し、 Python 3 にフォールバックしたい場合は、
867
+ | .vimrc | で 'pyxversion' を明示的に設定する必要があります。例 : >
865
868
if has('python')
866
869
set pyx=2
867
870
elseif has('python3')
0 commit comments