diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-05-15 18:28:13 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-05-15 18:28:13 +0200 |
commit | 3dab2806feefef69a6b614b9d98463bf4d9aa955 (patch) | |
tree | fd39e3d5db8c292761c1bde8fa8f13d26abc690f /runtime/doc/if_pyth.txt | |
parent | 71700b8903a8ccd172ae739f53520b59fc153bca (diff) | |
download | vim-git-3dab2806feefef69a6b614b9d98463bf4d9aa955.tar.gz |
updated for version 7.3.957v7.3.957
Problem: Python does not have a "do" command like Perl or Lua.
Solution: Add the ":py3do" command. (Lilydjwg)
Diffstat (limited to 'runtime/doc/if_pyth.txt')
-rw-r--r-- | runtime/doc/if_pyth.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 852c5c081..c56036744 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -490,6 +490,21 @@ if the `:py3` command is working: > < *:py3file* The |:py3file| command works similar to |:pyfile|. + *:py3do* +:[range]py3do {body} Execute Python function "def _vim_pydo(line, linenr): + {body}" for each line in the [range], with the + function arguments being set to the text of each line + in turn, without a trailing <EOL>, and the current + line number. The function should return a string or + None. If a string is returned, it becomes the text of + the line in the current turn. The default for [range] + is the whole file: "1,$". + {not in Vi} + +Examples: +> + :py3do return "%s\t%d" % (line[::-1], len(line)) + :py3do if line: return "%4d: %s" % (linenr, line) Vim can be built in four ways (:version output): 1. No Python support (-python, -python3) |