Mercurial > vim
comparison runtime/doc/if_pyth.txt @ 11062:1218c5353e2b
Runtime file updates.
commit https://github.com/vim/vim/commit/214641f77df6f318a4b3a0b09723c19859a103f4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 5 17:04:09 2017 +0100
Runtime file updates.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 05 Mar 2017 17:15:05 +0100 |
parents | e05695e59f6d |
children | d0a20101ecb2 |
comparison
equal
deleted
inserted
replaced
11061:0f11b92d7f5e | 11062:1218c5353e2b |
---|---|
1 *if_pyth.txt* For Vim version 8.0. Last change: 2017 Feb 17 | 1 *if_pyth.txt* For Vim version 8.0. Last change: 2017 Feb 18 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Paul Moore | 4 VIM REFERENCE MANUAL by Paul Moore |
5 | 5 |
6 | 6 |
172 # string.atoi() to convert to | 172 # string.atoi() to convert to |
173 # a number. | 173 # a number. |
174 | 174 |
175 :py tagList = vim.eval('taglist("eval_expr")') | 175 :py tagList = vim.eval('taglist("eval_expr")') |
176 < The latter will return a python list of python dicts, for instance: | 176 < The latter will return a python list of python dicts, for instance: |
177 [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': | 177 [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': ~ |
178 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] | 178 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] ~ |
179 | 179 |
180 vim.bindeval(str) *python-bindeval* | 180 vim.bindeval(str) *python-bindeval* |
181 Like |python-eval|, but returns special objects described in | 181 Like |python-eval|, but returns special objects described in |
182 |python-bindeval-objects|. These python objects let you modify (|List| | 182 |python-bindeval-objects|. These python objects let you modify (|List| |
183 or |Dictionary|) or call (|Funcref|) vim objects. | 183 or |Dictionary|) or call (|Funcref|) vim objects. |
817 | 817 |
818 ============================================================================== | 818 ============================================================================== |
819 11. Python X *python_x* *pythonx* | 819 11. Python X *python_x* *pythonx* |
820 | 820 |
821 Because most python code can be written so that it works with python 2.6+ and | 821 Because most python code can be written so that it works with python 2.6+ and |
822 python 3 the pyx* functions and commands have been writen. They work exactly | 822 python 3 the pyx* functions and commands have been written. They work exactly |
823 the same as the Python 2 and 3 variants, but select the Python version using | 823 the same as the Python 2 and 3 variants, but select the Python version using |
824 the 'pyxversion' setting. | 824 the 'pyxversion' setting. |
825 | 825 |
826 You should set 'pyxversion' in your |.vimrc| to prefer Python 2 or Python 3 | 826 You should set 'pyxversion' in your |.vimrc| to prefer Python 2 or Python 3 |
827 for Python commands. If you change this setting at runtime you may risk that | 827 for Python commands. If you change this setting at runtime you may risk that |
865 When compiled with both |+python| and |+python3|, the test depends on the | 865 When compiled with both |+python| and |+python3|, the test depends on the |
866 'pyxversion' setting. If 'pyxversion' is 0, it tests Python 3 first, and if | 866 'pyxversion' setting. If 'pyxversion' is 0, it tests Python 3 first, and if |
867 it is not available then Python 2. If 'pyxversion' is 2 or 3, it tests only | 867 it is not available then Python 2. If 'pyxversion' is 2 or 3, it tests only |
868 Python 2 or 3 respectively. | 868 Python 2 or 3 respectively. |
869 | 869 |
870 Note that for has('pythonx') to work it may try to dynamically load Python 3 | 870 Note that for `has('pythonx')` to work it may try to dynamically load Python 3 |
871 or 2. This may have side effects, especially when Vim can only load one of | 871 or 2. This may have side effects, especially when Vim can only load one of |
872 the two. | 872 the two. |
873 | 873 |
874 If a user prefers Python 2 and want to fallback to Python 3, he needs to set | 874 If a user prefers Python 2 and want to fallback to Python 3, he needs to set |
875 'pyxversion' explicitly in his |.vimrc|. E.g.: > | 875 'pyxversion' explicitly in his |.vimrc|. E.g.: > |