|
3 | 3 | helpname: 'if_pyth' |
4 | 4 | --- |
5 | 5 | <div id='vimCodeElement'> |
6 | | -<a class="Constant" href="if_pyth.html" name="if_pyth.txt">if_pyth.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2024 May 16<br> |
| 6 | +<a class="Constant" href="if_pyth.html" name="if_pyth.txt">if_pyth.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2024 Nov 06<br> |
7 | 7 | <br> |
8 | 8 | <br> |
9 | 9 | <span class="Identifier">VIMリファレンスマニュアル by Paul Moore</span><br> |
|
201 | 201 | <span class="PreProc">[{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name':</span><br> |
202 | 202 | <span class="PreProc">'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}]</span><br> |
203 | 203 | <br> |
| 204 | + <span class="Todo">NOTE</span>: vim9script では、def 関数内のローカル変数は Python の評価では見<br> |
| 205 | + えません。ローカル変数を Python の評価に渡すには、<a class="Identifier" href="builtin.html#py3eval()">py3eval()</a> 等を呼び<br> |
| 206 | + 出すときに <span class="Special">{locals}</span> 辞書を使用します。<br> |
| 207 | +<br> |
204 | 208 | vim.bindeval(str) <a class="Constant" href="if_pyth.html#python-bindeval" name="python-bindeval">python-bindeval</a><br> |
205 | 209 | <a class="Identifier" href="if_pyth.html#python-eval">python-eval</a> と似ていますが、特殊なオブジェクトを返します<br> |
206 | 210 | (<a class="Identifier" href="if_pyth.html#python-bindeval-objects">python-bindeval-objects</a> 参照)。これを使うと Vim のリスト (<a class="Identifier" href="eval.html#List">List</a>)<br> |
|
735 | 739 | 使って Python の式を評価して、その値を Vim script に渡すことができます。<br> |
736 | 740 | <a class="Identifier" href="builtin.html#pyxeval()">pyxeval()</a> も使用可能です。<br> |
737 | 741 | <br> |
| 742 | +オプションの <span class="Special">{locals}</span> 辞書を使用して、評価にローカル変数を挿入できます。これ<br> |
| 743 | +は、vim.eval <a class="Identifier" href="if_pyth.html#python-eval">python-eval</a> が def 関数内のローカル変数を見つけられない<br> |
| 744 | +vim9script で特に役立ちます。<br> |
| 745 | +<br> |
738 | 746 | Python での "None" は v:none に変換されます。<br> |
739 | 747 | <br> |
740 | 748 | <span class="PreProc">==============================================================================</span><br> |
|
0 commit comments