Mercurial > vim
comparison runtime/doc/if_lua.txt @ 2337:a0f87fc19d1d vim73
Better conceal in help. (partly by Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 18 Jul 2010 14:34:51 +0200 |
parents | 966a5609669e |
children | 12b829477c60 |
comparison
equal
deleted
inserted
replaced
2336:1a4a66f0c871 | 2337:a0f87fc19d1d |
---|---|
92 and$package$are available,$io$and$debug$are not, and$os$is restricted to | 92 and$package$are available,$io$and$debug$are not, and$os$is restricted to |
93 functions$date$,$clock$,$time$,$difftime$, and$getenv$. In addition, | 93 functions$date$,$clock$,$time$,$difftime$, and$getenv$. In addition, |
94 Lua$print$function has its output redirected to the Vim message area, with | 94 Lua$print$function has its output redirected to the Vim message area, with |
95 arguments separated by a white space instead of a tab. | 95 arguments separated by a white space instead of a tab. |
96 | 96 |
97 Lua uses the "vim" module (see|lua-vim|) to issue commands to Vim | 97 Lua uses the "vim" module (see |lua-vim|) to issue commands to Vim |
98 and manage buffers (|lua-buffer|) and windows (|lua-window|). However, | 98 and manage buffers (|lua-buffer|) and windows (|lua-window|). However, |
99 procedures that alter buffer content, open new buffers, and change cursor | 99 procedures that alter buffer content, open new buffers, and change cursor |
100 position are restricted when the command is executed in the|sandbox|. | 100 position are restricted when the command is executed in the |sandbox|. |
101 | 101 |
102 | 102 |
103 ============================================================================== | 103 ============================================================================== |
104 2. The vim module *lua-vim* | 104 2. The vim module *lua-vim* |
105 | 105 |
107 input range are stored in$vim.firstline$and$vim.lastline$respectively. The | 107 input range are stored in$vim.firstline$and$vim.lastline$respectively. The |
108 module also includes routines for buffer, window, and current line queries, | 108 module also includes routines for buffer, window, and current line queries, |
109 Vim evaluation and command execution, and others. | 109 Vim evaluation and command execution, and others. |
110 | 110 |
111 $vim.isbuffer(value)$ Returns#true#if$value$is a buffer userdata and | 111 $vim.isbuffer(value)$ Returns#true#if$value$is a buffer userdata and |
112 $false$otherwise (see|lua-buffer|). | 112 $false$otherwise (see |lua-buffer|). |
113 | 113 |
114 $vim.buffer($[arg]$)$ If$arg$is a number, returns buffer with number | 114 $vim.buffer($[arg]$)$ If$arg$is a number, returns buffer with number |
115 $arg$in the buffer list or, if$arg$is | 115 $arg$in the buffer list or, if$arg$is |
116 a string, returns buffer whose full or short | 116 a string, returns buffer whose full or short |
117 name is$arg$. In both cases, returns#nil#if | 117 name is$arg$. In both cases, returns#nil#if |
119 $toboolean(arg)$is#true#returns the first | 119 $toboolean(arg)$is#true#returns the first |
120 buffer in the buffer list or else the current | 120 buffer in the buffer list or else the current |
121 buffer. | 121 buffer. |
122 | 122 |
123 $vim.iswindow(value)$ Returns#true#if$value$is a window userdata and | 123 $vim.iswindow(value)$ Returns#true#if$value$is a window userdata and |
124 $false$otherwise (see|lua-window|). | 124 $false$otherwise (see |lua-window|). |
125 | 125 |
126 $vim.window($[arg]$)$ If$arg$is a number, returns window with number | 126 $vim.window($[arg]$)$ If$arg$is a number, returns window with number |
127 $arg$or#nil#if not found. Otherwise, if | 127 $arg$or#nil#if not found. Otherwise, if |
128 $toboolean(arg)$is#true#returns the first | 128 $toboolean(arg)$is#true#returns the first |
129 window or else the current window. | 129 window or else the current window. |
131 $vim.command(${cmd}$)$ Executes the vim (ex-mode) command {cmd}. | 131 $vim.command(${cmd}$)$ Executes the vim (ex-mode) command {cmd}. |
132 Examples: > | 132 Examples: > |
133 :lua vim.command"set tw=60" | 133 :lua vim.command"set tw=60" |
134 :lua vim.command"normal ddp" | 134 :lua vim.command"normal ddp" |
135 < | 135 < |
136 $vim.eval(${expr}$)$ Evaluates expression {expr} (see|expression|), | 136 $vim.eval(${expr}$)$ Evaluates expression {expr} (see |expression|), |
137 converts the result to Lua, and returns it. | 137 converts the result to Lua, and returns it. |
138 Vim strings and numbers are directly converted | 138 Vim strings and numbers are directly converted |
139 to Lua strings and numbers respectively. Vim | 139 to Lua strings and numbers respectively. Vim |
140 lists and dictionaries are converted to Lua | 140 lists and dictionaries are converted to Lua |
141 tables (lists become integer-keyed tables). | 141 tables (lists become integer-keyed tables). |