annotate runtime/doc/if_lua.txt @ 13937:cd513458728c

Updated runtime files commit https://github.com/vim/vim/commit/eb3dc87f01391bb075d97aef3d00f91b4e08a25c Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 13 22:34:24 2018 +0200 Updated runtime files
author Christian Brabandt <cb@256bit.org>
date Sun, 13 May 2018 22:45:06 +0200
parents 9f48eab77d62
children 1174611ad715
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10198
9f48eab77d62 commit https://github.com/vim/vim/commit/bb76f24af2010943387ce696a7092175b4ecccf2
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
1 *if_lua.txt* For Vim version 8.0. Last change: 2015 Oct 16
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 VIM REFERENCE MANUAL by Luis Carvalho
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 The Lua Interface to Vim *lua* *Lua*
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 1. Commands |lua-commands|
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 2. The vim module |lua-vim|
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
11 3. List userdata |lua-list|
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
12 4. Dict userdata |lua-dict|
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
13 5. Funcref userdata |lua-funcref|
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
14 6. Buffer userdata |lua-buffer|
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
15 7. Window userdata |lua-window|
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
16 8. The luaeval function |lua-luaeval|
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
17 9. Dynamic loading |lua-dynamic|
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 {Vi does not have any of these commands}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 The Lua interface is available only when Vim was compiled with the
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 |+lua| feature.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 ==============================================================================
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 1. Commands *lua-commands*
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 *:lua*
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 :[range]lua {chunk}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 Execute Lua chunk {chunk}. {not in Vi}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 Examples:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 :lua print("Hello, Vim!")
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 :lua local curbuf = vim.buffer() curbuf[7] = "line #7"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 <
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 :[range]lua << {endmarker}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 {script}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 {endmarker}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 Execute Lua script {script}. {not in Vi}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 Note: This command doesn't work when the Lua
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 feature wasn't compiled in. To avoid errors, see
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 |script-here|.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 {endmarker} must NOT be preceded by any white space. If {endmarker} is
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 omitted from after the "<<", a dot '.' must be used after {script}, like
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 for the |:append| and |:insert| commands.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 This form of the |:lua| command is mainly useful for including Lua code
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 in Vim scripts.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 Example:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 function! CurrentLineInfo()
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 lua << EOF
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 local linenr = vim.window().line
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 local curline = vim.buffer()[linenr]
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 print(string.format("Current line [%d] has %d chars",
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 linenr, #curline))
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 EOF
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 endfunction
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 <
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
62 To see what version of Lua you have: >
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
63 :lua print(_VERSION)
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
64
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
65 If you use LuaJIT you can also use this: >
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
66 :lua print(jit.version)
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 8673
diff changeset
67 <
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 *:luado*
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
70 :[range]luado {body} Execute Lua function "function (line, linenr) {body}
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
71 end" for each line in the [range], with the function
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
72 argument being set to the text of each line in turn,
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
73 without a trailing <EOL>, and the current line number.
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
74 If the value returned by the function is a string it
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
75 becomes the text of the line in the current turn. The
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
76 default for [range] is the whole file: "1,$".
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3450
diff changeset
77 {not in Vi}
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 Examples:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 :luado return string.format("%s\t%d", line:reverse(), #line)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 :lua require"lpeg"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 :lua -- balanced parenthesis grammar:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 :lua bp = lpeg.P{ "(" * ((1 - lpeg.S"()") + lpeg.V(1))^0 * ")" }
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 :luado if bp:match(line) then return "-->\t" .. line end
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 <
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 *:luafile*
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 :[range]luafile {file}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 Execute Lua script in {file}. {not in Vi}
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 The whole argument is used as a single file name.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 Examples:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 :luafile script.lua
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 :luafile %
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98 <
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 All these commands execute a Lua chunk from either the command line (:lua and
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 :luado) or a file (:luafile) with the given line [range]. Similarly to the Lua
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 interpreter, each chunk has its own scope and so only global variables are
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
103 shared between command calls. All Lua default libraries are available. In
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
104 addition, Lua "print" function has its output redirected to the Vim message
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
105 area, with arguments separated by a white space instead of a tab.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106
2337
a0f87fc19d1d Better conceal in help. (partly by Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents: 2320
diff changeset
107 Lua uses the "vim" module (see |lua-vim|) to issue commands to Vim
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 and manage buffers (|lua-buffer|) and windows (|lua-window|). However,
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 procedures that alter buffer content, open new buffers, and change cursor
2337
a0f87fc19d1d Better conceal in help. (partly by Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents: 2320
diff changeset
110 position are restricted when the command is executed in the |sandbox|.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 ==============================================================================
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 2. The vim module *lua-vim*
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 Lua interfaces Vim through the "vim" module. The first and last line of the
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
117 input range are stored in "vim.firstline" and "vim.lastline" respectively. The
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
118 module also includes routines for buffer, window, and current line queries,
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 Vim evaluation and command execution, and others.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
121 vim.list([arg]) Returns an empty list or, if "arg" is a Lua
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
122 table with numeric keys 1, ..., n (a
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
123 "sequence"), returns a list l such that l[i] =
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
124 arg[i] for i = 1, ..., n (see |List|).
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
125 Non-numeric keys are not used to initialize
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
126 the list. See also |lua-eval| for conversion
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
127 rules. Example: >
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
128 :lua t = {math.pi, false, say = 'hi'}
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
129 :echo luaeval('vim.list(t)')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
130 :" [3.141593, 0], 'say' is ignored
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
131 <
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
132 vim.dict([arg]) Returns an empty dictionary or, if "arg" is a
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
133 Lua table, returns a dict d such that d[k] =
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
134 arg[k] for all string keys k in "arg" (see
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
135 |Dictionary|). Number keys are converted to
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
136 strings. Keys that are not strings are not
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
137 used to initialize the dictionary. See also
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
138 |lua-eval| for conversion rules. Example: >
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
139 :lua t = {math.pi, false, say = 'hi'}
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
140 :echo luaeval('vim.dict(t)')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
141 :" {'say': 'hi'}, numeric keys ignored
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
142 <
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
143 vim.funcref({name}) Returns a Funcref to function {name} (see
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
144 |Funcref|). It is equivalent to Vim's
5340
22da5ab9aaa1 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
145 "function". NOT IMPLEMENTED YET
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
146
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
147 vim.buffer([arg]) If "arg" is a number, returns buffer with
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
148 number "arg" in the buffer list or, if "arg"
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
149 is a string, returns buffer whose full or short
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
150 name is "arg". In both cases, returns 'nil'
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
151 (nil value, not string) if the buffer is not
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
152 found. Otherwise, if "toboolean(arg)" is
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
153 'true' returns the first buffer in the buffer
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
154 list or else the current buffer.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
156 vim.window([arg]) If "arg" is a number, returns window with
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
157 number "arg" or 'nil' (nil value, not string)
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
158 if not found. Otherwise, if "toboolean(arg)"
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
159 is 'true' returns the first window or else the
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
160 current window.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
161
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
162 vim.type({arg}) Returns the type of {arg}. It is equivalent to
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
163 Lua's "type" function, but returns "list",
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
164 "dict", "funcref", "buffer", or "window" if
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
165 {arg} is a list, dictionary, funcref, buffer,
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
166 or window, respectively. Examples: >
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
167 :lua l = vim.list()
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
168 :lua print(type(l), vim.type(l))
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
169 :" userdata list
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
170 <
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
171 vim.command({cmd}) Executes the vim (ex-mode) command {cmd}.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
172 Examples: >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
173 :lua vim.command"set tw=60"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174 :lua vim.command"normal ddp"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
175 <
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
176 vim.eval({expr}) Evaluates expression {expr} (see |expression|),
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177 converts the result to Lua, and returns it.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
178 Vim strings and numbers are directly converted
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
179 to Lua strings and numbers respectively. Vim
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
180 lists and dictionaries are converted to Lua
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
181 userdata (see |lua-list| and |lua-dict|).
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
182 Examples: >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
183 :lua tw = vim.eval"&tw"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
184 :lua print(vim.eval"{'a': 'one'}".a)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
185 <
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
186 vim.line() Returns the current line (without the trailing
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
187 <EOL>), a Lua string.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
188
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
189 vim.beep() Beeps.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
190
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
191 vim.open({fname}) Opens a new buffer for file {fname} and
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
192 returns it. Note that the buffer is not set as
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
193 current.
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
194
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
195
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
196 ==============================================================================
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
197 3. List userdata *lua-list*
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
198
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
199 List userdata represent vim lists, and the interface tries to follow closely
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
200 Vim's syntax for lists. Since lists are objects, changes in list references in
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
201 Lua are reflected in Vim and vice-versa. A list "l" has the following
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
202 properties and methods:
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
203
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
204 Properties
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
205 ----------
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
206 o "#l" is the number of items in list "l", equivalent to "len(l)"
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
207 in Vim.
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
208 o "l[k]" returns the k-th item in "l"; "l" is zero-indexed, as in Vim.
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
209 To modify the k-th item, simply do "l[k] = newitem"; in
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
210 particular, "l[k] = nil" removes the k-th item from "l".
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
211 o "l()" returns an iterator for "l".
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
212
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
213 Methods
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
214 -------
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
215 o "l:add(item)" appends "item" to the end of "l".
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
216 o "l:insert(item[, pos])" inserts "item" at (optional)
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
217 position "pos" in the list. The default value for "pos" is 0.
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
218
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
219 Examples:
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
220 >
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
221 :let l = [1, 'item']
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
222 :lua l = vim.eval('l') -- same 'l'
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
223 :lua l:add(vim.list())
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
224 :lua l[0] = math.pi
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
225 :echo l[0] " 3.141593
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
226 :lua l[0] = nil -- remove first item
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
227 :lua l:insert(true, 1)
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
228 :lua print(l, #l, l[0], l[1], l[-1])
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
229 :lua for item in l() do print(item) end
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
230 <
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
231
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
232 ==============================================================================
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
233 4. Dict userdata *lua-dict*
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
234
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
235 Similarly to list userdata, dict userdata represent vim dictionaries; since
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
236 dictionaries are also objects, references are kept between Lua and Vim. A dict
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
237 "d" has the following properties:
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
238
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
239 Properties
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
240 ----------
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
241 o "#d" is the number of items in dict "d", equivalent to "len(d)"
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
242 in Vim.
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
243 o "d.key" or "d['key']" returns the value at entry "key" in "d".
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
244 To modify the entry at this key, simply do "d.key = newvalue"; in
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
245 particular, "d.key = nil" removes the entry from "d".
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
246 o "d()" returns an iterator for "d" and is equivalent to "items(d)" in
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
247 Vim.
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
248
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
249 Examples:
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
250 >
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
251 :let d = {'n':10}
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
252 :lua d = vim.eval('d') -- same 'd'
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
253 :lua print(d, d.n, #d)
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
254 :let d.self = d
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
255 :lua for k, v in d() do print(d, k, v) end
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
256 :lua d.x = math.pi
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
257 :lua d.self = nil -- remove entry
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
258 :echo d
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
259 <
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
260
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
261 ==============================================================================
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
262 5. Funcref userdata *lua-funcref*
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
263
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
264 Funcref userdata represent funcref variables in Vim. Funcrefs that were
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
265 defined with a "dict" attribute need to be obtained as a dictionary key
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
266 in order to have "self" properly assigned to the dictionary (see examples
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
267 below.) A funcref "f" has the following properties:
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
268
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
269 Properties
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
270 ----------
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
271 o "#f" is the name of the function referenced by "f"
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
272 o "f(...)" calls the function referenced by "f" (with arguments)
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
273
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
274 Examples:
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
275 >
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
276 :function I(x)
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
277 : return a:x
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
278 : endfunction
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
279 :let R = function('I')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
280 :lua i1 = vim.funcref('I')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
281 :lua i2 = vim.eval('R')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
282 :lua print(#i1, #i2) -- both 'I'
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
283 :lua print(i1, i2, #i2(i1) == #i1(i2))
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
284 :function Mylen() dict
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
285 : return len(self.data)
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
286 : endfunction
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
287 :let mydict = {'data': [0, 1, 2, 3]}
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
288 :lua d = vim.eval('mydict'); d.len = vim.funcref('Mylen')
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
289 :echo mydict.len()
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
290 :lua l = d.len -- assign d as 'self'
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
291 :lua print(l())
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
292 <
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
293
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
294 ==============================================================================
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
295 6. Buffer userdata *lua-buffer*
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
296
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
297 Buffer userdata represent vim buffers. A buffer userdata "b" has the following
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
298 properties and methods:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
299
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
300 Properties
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
301 ----------
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
302 o "b()" sets "b" as the current buffer.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
303 o "#b" is the number of lines in buffer "b".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
304 o "b[k]" represents line number k: "b[k] = newline" replaces line k
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
305 with string "newline" and "b[k] = nil" deletes line k.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
306 o "b.name" contains the short name of buffer "b" (read-only).
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
307 o "b.fname" contains the full name of buffer "b" (read-only).
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
308 o "b.number" contains the position of buffer "b" in the buffer list
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
309 (read-only).
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
310
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
311 Methods
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
312 -------
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
313 o "b:insert(newline[, pos])" inserts string "newline" at (optional)
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
314 position "pos" in the buffer. The default value for "pos" is
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
315 "#b + 1". If "pos == 0" then "newline" becomes the first line in
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
316 the buffer.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
317 o "b:next()" returns the buffer next to "b" in the buffer list.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
318 o "b:previous()" returns the buffer previous to "b" in the buffer
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
319 list.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
320 o "b:isvalid()" returns 'true' (boolean) if buffer "b" corresponds to
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
321 a "real" (not freed from memory) Vim buffer.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
322
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
323 Examples:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
324 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
325 :lua b = vim.buffer() -- current buffer
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
326 :lua print(b.name, b.number)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
327 :lua b[1] = "first line"
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
328 :lua b:insert("FIRST!", 0)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
329 :lua b[1] = nil -- delete top line
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
330 :lua for i=1,3 do b:insert(math.random()) end
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
331 :3,4lua for i=vim.lastline,vim.firstline,-1 do b[i] = nil end
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
332 :lua vim.open"myfile"() -- open buffer and set it as current
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
333
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
334 function! ListBuffers()
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
335 lua << EOF
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
336 local b = vim.buffer(true) -- first buffer in list
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
337 while b ~= nil do
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
338 print(b.number, b.name, #b)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
339 b = b:next()
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
340 end
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
341 vim.beep()
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
342 EOF
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
343 endfunction
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
344 <
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
345
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
346 ==============================================================================
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
347 7. Window userdata *lua-window*
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
348
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
349 Window objects represent vim windows. A window userdata "w" has the following
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
350 properties and methods:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
351
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
352 Properties
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
353 ----------
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
354 o "w()" sets "w" as the current window.
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
355 o "w.buffer" contains the buffer of window "w" (read-only).
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
356 o "w.line" represents the cursor line position in window "w".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
357 o "w.col" represents the cursor column position in window "w".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
358 o "w.width" represents the width of window "w".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
359 o "w.height" represents the height of window "w".
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
360
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
361 Methods
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
362 -------
2373
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
363 o "w:next()" returns the window next to "w".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
364 o "w:previous()" returns the window previous to "w".
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
365 o "w:isvalid()" returns 'true' (boolean) if window "w" corresponds to
f149bb1cf5be Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents: 2345
diff changeset
366 a "real" (not freed from memory) Vim window.
2320
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
367
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
368 Examples:
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
369 >
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
370 :lua w = vim.window() -- current window
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
371 :lua print(w.buffer.name, w.line, w.col)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
372 :lua w.width = w.width + math.random(10)
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
373 :lua w.height = 2 * math.random() * w.height
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
374 :lua n,w = 0,vim.window(true) while w~=nil do n,w = n + 1,w:next() end
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
375 :lua print("There are " .. n .. " windows")
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
376 <
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
377
966a5609669e Added Lua interfae. (Luis Carvalho)
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
378 ==============================================================================
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
379 8. The luaeval function *lua-luaeval* *lua-eval*
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
380
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
381 The (dual) equivalent of "vim.eval" for passing Lua values to Vim is
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
382 "luaeval". "luaeval" takes an expression string and an optional argument and
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
383 returns the result of the expression. It is semantically equivalent in Lua to:
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
384 >
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
385 local chunkheader = "local _A = select(1, ...) return "
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
386 function luaeval (expstr, arg)
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
387 local chunk = assert(loadstring(chunkheader .. expstr, "luaeval"))
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
388 return chunk(arg) -- return typval
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
389 end
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
390 <
4911
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
391 Note that "_A" receives the argument to "luaeval". Lua numbers, strings, and
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
392 list, dict, and funcref userdata are converted to their Vim respective types,
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
393 while Lua booleans are converted to numbers. An error is thrown if conversion
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
394 of any of the remaining Lua types, including userdata other than lists, dicts,
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
395 and funcrefs, is attempted.
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
396
78c318784090 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
397 Examples: >
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
398
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
399 :echo luaeval('math.pi')
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
400 :lua a = vim.list():add('newlist')
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
401 :let a = luaeval('a')
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
402 :echo a[0] " 'newlist'
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
403 :function Rand(x,y) " random uniform between x and y
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
404 : return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y})
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
405 : endfunction
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
406 :echo Rand(1,10)
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
407
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
408
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
409 ==============================================================================
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
410 9. Dynamic loading *lua-dynamic*
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
411
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
412 On MS-Windows and Unix the Lua library can be loaded dynamically. The
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
413 |:version| output then includes |+lua/dyn|.
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
414
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
415 This means that Vim will search for the Lua DLL or shared library file only
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
416 when needed. When you don't use the Lua interface you don't need it, thus
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
417 you can use Vim without this file.
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
418
8673
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
419
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
420 MS-Windows ~
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
421
8673
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
422 To use the Lua interface the Lua DLL must be in your search path. In a
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
423 console window type "path" to see what directories are used. The 'luadll'
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
424 option can be also used to specify the Lua DLL. The version of the DLL must
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
425 match the Lua version Vim was compiled with.
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
426
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
427
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
428 Unix ~
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
429
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
430 The 'luadll' option can be used to specify the Lua shared library file instead
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
431 of DYNAMIC_LUA_DLL file what was specified at compile time. The version of
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
432 the shared library must match the Lua version Vim was compiled with.
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
433
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
434
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 5340
diff changeset
435 ==============================================================================
3450
b067b8b81be9 updated for version 7.3.490
Bram Moolenaar <bram@vim.org>
parents: 2572
diff changeset
436 vim:tw=78:ts=8:noet:ft=help:norl: