blob: e822dfd170b7380ceee562f6aab9d42b9f0b6149 [file] [log] [blame]
Bram Moolenaarb1c91982018-05-17 17:04:55 +02001*if_tcl.txt* For Vim version 8.1. Last change: 2016 Jan 01
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Ingo Wilken
5
6
7The Tcl Interface to Vim *tcl* *Tcl* *TCL*
8
91. Commands |tcl-ex-commands|
102. Tcl commands |tcl-commands|
113. Tcl variables |tcl-variables|
124. Tcl window commands |tcl-window-cmds|
135. Tcl buffer commands |tcl-buffer-cmds|
146. Miscellaneous; Output from Tcl |tcl-misc| |tcl-output|
157. Known bugs & problems |tcl-bugs|
168. Examples |tcl-examples|
Bram Moolenaara5792f52005-11-23 21:25:05 +0000179. Dynamic loading |tcl-dynamic|
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +020019{Vi does not have any of these commands} *E280*
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21The Tcl interface only works when Vim was compiled with the |+tcl| feature.
22
23WARNING: There are probably still some bugs. Please send bug reports,
24comments, ideas etc to <Ingo.Wilken@informatik.uni-oldenburg.de>
25
26==============================================================================
271. Commands *tcl-ex-commands* *E571* *E572*
28
29 *:tcl* *:tc*
Bram Moolenaar9b451252012-08-15 17:43:31 +020030:tc[l] {cmd} Execute Tcl command {cmd}. A simple check if `:tcl`
31 is working: >
32 :tcl puts "Hello"
Bram Moolenaar071d4272004-06-13 20:20:40 +000033
34:[range]tc[l] << {endmarker}
35{script}
36{endmarker}
37 Execute Tcl script {script}.
38 Note: This command doesn't work when the Tcl feature
39 wasn't compiled in. To avoid errors, see
40 |script-here|.
41
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000042{endmarker} must NOT be preceded by any white space. If {endmarker} is
Bram Moolenaar071d4272004-06-13 20:20:40 +000043omitted from after the "<<", a dot '.' must be used after {script}, like for
44the |:append| and |:insert| commands.
45This form of the |:tcl| command is mainly useful for including tcl code in Vim
46scripts.
47
48Example: >
49 function! DefineDate()
50 tcl << EOF
51 proc date {} {
52 return [clock format [clock seconds]]
53 }
54 EOF
55 endfunction
56<
Bram Moolenaarabd468e2016-09-08 22:22:43 +020057To see what version of Tcl you have: >
58 :tcl puts [info patchlevel]
59<
Bram Moolenaar071d4272004-06-13 20:20:40 +000060
61 *:tcldo* *:tcld*
62:[range]tcld[o] {cmd} Execute Tcl command {cmd} for each line in [range]
63 with the variable "line" being set to the text of each
64 line in turn, and "lnum" to the line number. Setting
65 "line" will change the text, but note that it is not
66 possible to add or delete lines using this command.
67 If {cmd} returns an error, the command is interrupted.
68 The default for [range] is the whole file: "1,$".
69 See |tcl-var-line| and |tcl-var-lnum|. {not in Vi}
70
71 *:tclfile* *:tclf*
72:tclf[ile] {file} Execute the Tcl script in {file}. This is the same as
73 ":tcl source {file}", but allows file name completion.
74 {not in Vi}
75
76
77Note that Tcl objects (like variables) persist from one command to the next,
78just as in the Tcl shell.
79
80Executing Tcl commands is not possible in the |sandbox|.
81
82==============================================================================
832. Tcl commands *tcl-commands*
84
85Tcl code gets all of its access to vim via commands in the "::vim" namespace.
86The following commands are implemented: >
87
88 ::vim::beep # Guess.
89 ::vim::buffer {n} # Create Tcl command for one buffer.
90 ::vim::buffer list # Create Tcl commands for all buffers.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010091 ::vim::command [-quiet] {cmd} # Execute an Ex command.
Bram Moolenaar071d4272004-06-13 20:20:40 +000092 ::vim::expr {expr} # Use Vim's expression evaluator.
93 ::vim::option {opt} # Get vim option.
94 ::vim::option {opt} {val} # Set vim option.
95 ::vim::window list # Create Tcl commands for all windows.
96
97Commands:
98 ::vim::beep *tcl-beep*
99 Honk. Does not return a result.
100
101 ::vim::buffer {n} *tcl-buffer*
102 ::vim::buffer exists {n}
103 ::vim::buffer list
104 Provides access to vim buffers. With an integer argument, creates a
105 buffer command (see |tcl-buffer-cmds|) for the buffer with that
106 number, and returns its name as the result. Invalid buffer numbers
107 result in a standard Tcl error. To test for valid buffer numbers,
108 vim's internal functions can be used: >
109 set nbufs [::vim::expr bufnr("$")]
110 set isvalid [::vim::expr "bufexists($n)"]
111< The "list" option creates a buffer command for each valid buffer, and
112 returns a list of the command names as the result.
113 Example: >
114 set bufs [::vim::buffer list]
115 foreach b $bufs { $b append end "The End!" }
116< The "exists" option checks if a buffer with the given number exists.
117 Example: >
118 if { [::vim::buffer exists $n] } { ::vim::command ":e #$n" }
119< This command might be replaced by a variable in future versions.
120 See also |tcl-var-current| for the current buffer.
121
122 ::vim::command {cmd} *tcl-command*
123 ::vim::command -quiet {cmd}
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100124 Execute the vim (ex-mode) command {cmd}. Any Ex command that affects
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125 a buffer or window uses the current buffer/current window. Does not
126 return a result other than a standard Tcl error code. After this
127 command is completed, the "::vim::current" variable is updated.
128 The "-quiet" flag suppresses any error messages from vim.
129 Examples: >
130 ::vim::command "set ts=8"
131 ::vim::command "%s/foo/bar/g"
132< To execute normal-mode commands, use "normal" (see |:normal|): >
133 set cmd "jj"
134 ::vim::command "normal $cmd"
135< See also |tcl-window-command| and |tcl-buffer-command|.
136
137 ::vim::expr {expr} *tcl-expr*
138 Evaluates the expression {expr} using vim's internal expression
139 evaluator (see |expression|). Any expression that queries a buffer
140 or window property uses the current buffer/current window. Returns
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000141 the result as a string. A |List| is turned into a string by joining
142 the items and inserting line breaks.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143 Examples: >
144 set perl_available [::vim::expr has("perl")]
145< See also |tcl-window-expr| and |tcl-buffer-expr|.
146
147 ::vim::option {opt} *tcl-option*
148 ::vim::option {opt} {value}
149 Without second argument, queries the value of a vim option. With this
150 argument, sets the vim option to {value}, and returns the previous
151 value as the result. Any options that are marked as 'local to buffer'
152 or 'local to window' affect the current buffer/current window. The
153 global value is not changed, use the ":set" command for that. For
154 boolean options, {value} should be "0" or "1", or any of the keywords
155 "on", "off" or "toggle". See |option-summary| for a list of options.
156 Example: >
157 ::vim::option ts 8
158< See also |tcl-window-option| and |tcl-buffer-option|.
159
160 ::vim::window {option} *tcl-window*
161 Provides access to vim windows. Currently only the "list" option is
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000162 implemented. This creates a window command (see |tcl-window-cmds|) for
Bram Moolenaar071d4272004-06-13 20:20:40 +0000163 each window, and returns a list of the command names as the result.
164 Example: >
165 set wins [::vim::window list]
166 foreach w $wins { $w height 4 }
167< This command might be replaced by a variable in future versions.
168 See also |tcl-var-current| for the current window.
169
170==============================================================================
1713. Tcl variables *tcl-variables*
172
173The ::vim namespace contains a few variables. These are created when the Tcl
174interpreter is called from vim and set to current values. >
175
176 ::vim::current # array containing "current" objects
177 ::vim::lbase # number of first line
178 ::vim::range # array containing current range numbers
179 line # current line as a string (:tcldo only)
180 lnum # current line number (:tcldo only)
181
182Variables:
183 ::vim::current *tcl-var-current*
184 This is an array providing access to various "current" objects
185 available in vim. The contents of this array are updated after
186 "::vim::command" is called, as this might change vim's current
187 settings (e.g., by deleting the current buffer).
188 The "buffer" element contains the name of the buffer command for the
189 current buffer. This can be used directly to invoke buffer commands
190 (see |tcl-buffer-cmds|). This element is read-only.
191 Example: >
192 $::vim::current(buffer) insert begin "Hello world"
193< The "window" element contains the name of the window command for the
194 current window. This can be used directly to invoke window commands
195 (see |tcl-window-cmds|). This element is read-only.
196 Example: >
197 $::vim::current(window) height 10
198<
199 ::vim::lbase *tcl-var-lbase*
200 This variable controls how Tcl treats line numbers. If it is set to
201 '1', then lines and columns start at 1. This way, line numbers from
202 Tcl commands and vim expressions are compatible. If this variable is
203 set to '0', then line numbers and columns start at 0 in Tcl. This is
204 useful if you want to treat a buffer as a Tcl list or a line as a Tcl
205 string and use standard Tcl commands that return an index ("lsort" or
206 "string first", for example). The default value is '1'. Currently,
207 any non-zero values is treated as '1', but your scripts should not
208 rely on this. See also |tcl-linenumbers|.
209
210 ::vim::range *tcl-var-range*
211 This is an array with three elements, "start", "begin" and "end". It
212 contains the line numbers of the start and end row of the current
213 range. "begin" is the same as "start". This variable is read-only.
214 See |tcl-examples|.
215
216 line *tcl-var-line*
217 lnum *tcl-var-lnum*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100218 These global variables are only available if the ":tcldo" Ex command
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219 is being executed. They contain the text and line number of the
220 current line. When the Tcl command invoked by ":tcldo" is completed,
221 the current line is set to the contents of the "line" variable, unless
222 the variable was unset by the Tcl command. The "lnum" variable is
223 read-only. These variables are not in the "::vim" namespace so they
224 can be used in ":tcldo" without much typing (this might be changed in
225 future versions). See also |tcl-linenumbers|.
226
227==============================================================================
2284. Tcl window commands *tcl-window-cmds*
229
230Window commands represent vim windows. They are created by several commands:
231 ::vim::window list |tcl-window|
232 "windows" option of a buffer command |tcl-buffer-windows|
233The ::vim::current(window) variable contains the name of the window command
234for the current window. A window command is automatically deleted when the
235corresponding vim window is closed.
236
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000237Let's assume the name of the window command is stored in the Tcl variable "win",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238i.e. "$win" calls the command. The following options are available: >
239
240 $win buffer # Create Tcl command for window's buffer.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100241 $win command {cmd} # Execute Ex command in windows context.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242 $win cursor # Get current cursor position.
243 $win cursor {var} # Set cursor position from array variable.
244 $win cursor {row} {col} # Set cursor position.
245 $win delcmd {cmd} # Call Tcl command when window is closed.
246 $win expr {expr} # Evaluate vim expression in windows context.
247 $win height # Report the window's height.
248 $win height {n} # Set the window's height.
249 $win option {opt} [val] # Get/Set vim option in windows context.
250
251Options:
252 $win buffer *tcl-window-buffer*
253 Creates a Tcl command for the window's buffer, and returns its name as
254 the result. The name should be stored in a variable: >
255 set buf [$win buffer]
256< $buf is now a valid Tcl command. See |tcl-buffer-cmds| for the
257 available options.
258
259 $win cursor *tcl-window-cursor*
260 $win cursor {var}
261 $win cursor {row} {col}
262 Without argument, reports the current cursor position as a string.
263 This can be converted to a Tcl array variable: >
264 array set here [$win cursor]
265< "here(row)" and "here(column)" now contain the cursor position.
266 With a single argument, the argument is interpreted as the name of a
267 Tcl array variable, which must contain two elements "row" and "column".
268 These are used to set the cursor to the new position: >
269 $win cursor here ;# not $here !
270< With two arguments, sets the cursor to the specified row and column: >
271 $win cursor $here(row) $here(column)
272< Invalid positions result in a standard Tcl error, which can be caught
273 with "catch". The row and column values depend on the "::vim::lbase"
274 variable. See |tcl-var-lbase|.
275
276 $win delcmd {cmd} *tcl-window-delcmd*
277 Registers the Tcl command {cmd} as a deletion callback for the window.
278 This command is executed (in the global scope) just before the window
279 is closed. Complex commands should be build with "list": >
280 $win delcmd [list puts vimerr "window deleted"]
281< See also |tcl-buffer-delcmd|.
282
283 $win height *tcl-window-height*
284 $win height {n}
285 Without argument, reports the window's current height. With an
286 argument, tries to set the window's height to {n}, then reports the
287 new height (which might be different from {n}).
288
289 $win command [-quiet] {cmd} *tcl-window-command*
290 $win expr {expr} *tcl-window-expr*
291 $win option {opt} [val] *tcl-window-option*
292 These are similar to "::vim::command" etc., except that everything is
293 done in the context of the window represented by $win, instead of the
294 current window. For example, setting an option that is marked 'local
295 to window' affects the window $win. Anything that affects or queries
296 a buffer uses the buffer displayed in this window (i.e. the buffer
297 that is represented by "$win buffer"). See |tcl-command|, |tcl-expr|
298 and |tcl-option| for more information.
299 Example: >
300 $win option number on
301
302==============================================================================
3035. Tcl buffer commands *tcl-buffer-cmds*
304
305Buffer commands represent vim buffers. They are created by several commands:
306 ::vim::buffer {N} |tcl-buffer|
307 ::vim::buffer list |tcl-buffer|
308 "buffer" option of a window command |tcl-window-buffer|
309The ::vim::current(buffer) variable contains the name of the buffer command
310for the current buffer. A buffer command is automatically deleted when the
311corresponding vim buffer is destroyed. Whenever the buffer's contents are
312changed, all marks in the buffer are automatically adjusted. Any changes to
313the buffer's contents made by Tcl commands can be undone with the "undo" vim
314command (see |undo|).
315
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000316Let's assume the name of the buffer command is stored in the Tcl variable "buf",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000317i.e. "$buf" calls the command. The following options are available: >
318
319 $buf append {n} {str} # Append a line to buffer, after line {n}.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100320 $buf command {cmd} # Execute Ex command in buffers context.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321 $buf count # Report number of lines in buffer.
322 $buf delcmd {cmd} # Call Tcl command when buffer is deleted.
323 $buf delete {n} # Delete a single line.
324 $buf delete {n} {m} # Delete several lines.
325 $buf expr {expr} # Evaluate vim expression in buffers context.
326 $buf get {n} # Get a single line as a string.
327 $buf get {n} {m} # Get several lines as a list.
328 $buf insert {n} {str} # Insert a line in buffer, as line {n}.
329 $buf last # Report line number of last line in buffer.
330 $buf mark {mark} # Report position of buffer mark.
331 $buf name # Report name of file in buffer.
332 $buf number # Report number of this buffer.
333 $buf option {opt} [val] # Get/Set vim option in buffers context.
334 $buf set {n} {text} # Replace a single line.
335 $buf set {n} {m} {list} # Replace several lines.
336 $buf windows # Create Tcl commands for buffer's windows.
337<
338 *tcl-linenumbers*
339Most buffer commands take line numbers as arguments. How Tcl treats these
340numbers depends on the "::vim::lbase" variable (see |tcl-var-lbase|). Instead
341of line numbers, several keywords can be also used: "top", "start", "begin",
342"first", "bottom", "end" and "last".
343
344Options:
345 $buf append {n} {str} *tcl-buffer-append*
346 $buf insert {n} {str} *tcl-buffer-insert*
347 Add a line to the buffer. With the "insert" option, the string
348 becomes the new line {n}, with "append" it is inserted after line {n}.
349 Example: >
350 $buf insert top "This is the beginning."
351 $buf append end "This is the end."
352< To add a list of lines to the buffer, use a loop: >
353 foreach line $list { $buf append $num $line ; incr num }
354<
355 $buf count *tcl-buffer-count*
356 Reports the total number of lines in the buffer.
357
358 $buf delcmd {cmd} *tcl-buffer-delcmd*
359 Registers the Tcl command {cmd} as a deletion callback for the buffer.
360 This command is executed (in the global scope) just before the buffer
361 is deleted. Complex commands should be build with "list": >
362 $buf delcmd [list puts vimerr "buffer [$buf number] gone"]
363< See also |tcl-window-delcmd|.
364
365 $buf delete {n} *tcl-buffer-delete*
366 $buf delete {n} {m}
367 Deletes line {n} or lines {n} through {m} from the buffer.
368 This example deletes everything except the last line: >
369 $buf delete first [expr [$buf last] - 1]
370<
371 $buf get {n} *tcl-buffer-get*
372 $buf get {n} {m}
373 Gets one or more lines from the buffer. For a single line, the result
374 is a string; for several lines, a list of strings.
375 Example: >
376 set topline [$buf get top]
377<
378 $buf last *tcl-buffer-last*
379 Reports the line number of the last line. This value depends on the
380 "::vim::lbase" variable. See |tcl-var-lbase|.
381
382 $buf mark {mark} *tcl-buffer-mark*
383 Reports the position of the named mark as a string, similar to the
384 cursor position of the "cursor" option of a window command (see
385 |tcl-window-cursor|). This can be converted to a Tcl array variable: >
386 array set mpos [$buf mark "a"]
387< "mpos(column)" and "mpos(row)" now contain the position of the mark.
388 If the mark is not set, a standard Tcl error results.
389
390 $buf name
391 Reports the name of the file in the buffer. For a buffer without a
392 file, this is an empty string.
393
394 $buf number
395 Reports the number of this buffer. See |:buffers|.
396 This example deletes a buffer from vim: >
397 ::vim::command "bdelete [$buf number]"
398<
399 $buf set {n} {string} *tcl-buffer-set*
400 $buf set {n} {m} {list}
401 Replace one or several lines in the buffer. If the list contains more
402 elements than there are lines to replace, they are inserted into the
403 buffer. If the list contains fewer elements, any unreplaced line is
404 deleted from the buffer.
405
406 $buf windows *tcl-buffer-windows*
407 Creates a window command for each window that displays this buffer, and
408 returns a list of the command names as the result.
409 Example: >
410 set winlist [$buf windows]
411 foreach win $winlist { $win height 4 }
412< See |tcl-window-cmds| for the available options.
413
414 $buf command [-quiet] {cmd} *tcl-buffer-command*
Bram Moolenaarc236c162008-07-13 17:41:49 +0000415 $buf expr {expr} *tcl-buffer-expr*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000416 $buf option {opt} [val] *tcl-buffer-option*
417 These are similar to "::vim::command" etc., except that everything is
418 done in the context of the buffer represented by $buf, instead of the
419 current buffer. For example, setting an option that is marked 'local
420 to buffer' affects the buffer $buf. Anything that affects or queries
421 a window uses the first window in vim's window list that displays this
422 buffer (i.e. the first entry in the list returned by "$buf windows").
423 See |tcl-command|, |tcl-expr| and |tcl-option| for more information.
424 Example: >
425 if { [$buf option modified] } { $buf command "w" }
426
427==============================================================================
4286. Miscellaneous; Output from Tcl *tcl-misc* *tcl-output*
429
430The standard Tcl commands "exit" and "catch" are replaced by custom versions.
431"exit" terminates the current Tcl script and returns to vim, which deletes the
432Tcl interpreter. Another call to ":tcl" then creates a new Tcl interpreter.
433"exit" does NOT terminate vim! "catch" works as before, except that it does
434not prevent script termination from "exit". An exit code != 0 causes the ex
435command that invoked the Tcl script to return an error.
436
437Two new I/O streams are available in Tcl, "vimout" and "vimerr". All output
438directed to them is displayed in the vim message area, as information messages
439and error messages, respectively. The standard Tcl output streams stdout and
440stderr are mapped to vimout and vimerr, so that a normal "puts" command can be
441used to display messages in vim.
442
443==============================================================================
4447. Known bugs & problems *tcl-bugs*
445
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100446Calling one of the Tcl Ex commands from inside Tcl (via "::vim::command") may
Bram Moolenaar071d4272004-06-13 20:20:40 +0000447have unexpected side effects. The command creates a new interpreter, which
448has the same abilities as the standard interpreter - making "::vim::command"
449available in a safe child interpreter therefore makes the child unsafe. (It
450would be trivial to block nested :tcl* calls or ensure that such calls from a
451safe interpreter create only new safe interpreters, but quite pointless -
452depending on vim's configuration, "::vim::command" may execute arbitrary code
453in any number of other scripting languages.) A call to "exit" within this new
454interpreter does not affect the old interpreter; it only terminates the new
455interpreter, then script processing continues normally in the old interpreter.
456
457Input from stdin is currently not supported.
458
459==============================================================================
4608. Examples: *tcl-examples*
461
462Here are a few small (and maybe useful) Tcl scripts.
463
464This script sorts the lines of the entire buffer (assume it contains a list
465of names or something similar):
466 set buf $::vim::current(buffer)
467 set lines [$buf get top bottom]
468 set lines [lsort -dictionary $lines]
469 $buf set top bottom $lines
470
471This script reverses the lines in the buffer. Note the use of "::vim::lbase"
472and "$buf last" to work with any line number setting.
473 set buf $::vim::current(buffer)
474 set t $::vim::lbase
475 set b [$buf last]
476 while { $t < $b } {
477 set tl [$buf get $t]
478 set bl [$buf get $b]
479 $buf set $t $bl
480 $buf set $b $tl
481 incr t
482 incr b -1
483 }
484
485This script adds a consecutive number to each line in the current range:
486 set buf $::vim::current(buffer)
487 set i $::vim::range(start)
488 set n 1
489 while { $i <= $::vim::range(end) } {
490 set line [$buf get $i]
491 $buf set $i "$n\t$line"
492 incr i ; incr n
493 }
494
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100495The same can also be done quickly with two Ex commands, using ":tcldo":
Bram Moolenaar071d4272004-06-13 20:20:40 +0000496 :tcl set n 1
497 :[range]tcldo set line "$n\t$line" ; incr n
498
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100499This procedure runs an Ex command on each buffer (idea stolen from Ron Aaron):
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500 proc eachbuf { cmd } {
501 foreach b [::vim::buffer list] {
502 $b command $cmd
503 }
504 }
505Use it like this:
506 :tcl eachbuf %s/foo/bar/g
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000507Be careful with Tcl's string and backslash substitution, tough. If in doubt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100508surround the Ex command with curly braces.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000509
510
511If you want to add some Tcl procedures permanently to vim, just place them in
512a file (e.g. "~/.vimrc.tcl" on Unix machines), and add these lines to your
513startup file (usually "~/.vimrc" on Unix):
514 if has("tcl")
515 tclfile ~/.vimrc.tcl
516 endif
517
518==============================================================================
Bram Moolenaara5792f52005-11-23 21:25:05 +00005199. Dynamic loading *tcl-dynamic*
520
Bram Moolenaar8a5115c2016-01-09 19:41:11 +0100521On MS-Windows and Unix the Tcl library can be loaded dynamically. The
522|:version| output then includes |+tcl/dyn|.
Bram Moolenaara5792f52005-11-23 21:25:05 +0000523
Bram Moolenaar8a5115c2016-01-09 19:41:11 +0100524This means that Vim will search for the Tcl DLL or shared library file only
525when needed. When you don't use the Tcl interface you don't need it, thus you
526can use Vim without this file.
527
528
529MS-Windows ~
Bram Moolenaara5792f52005-11-23 21:25:05 +0000530
531To use the Tcl interface the Tcl DLL must be in your search path. In a
Bram Moolenaare18c0b32016-03-20 21:08:34 +0100532console window type "path" to see what directories are used. The 'tcldll'
533option can be also used to specify the Tcl DLL.
Bram Moolenaara5792f52005-11-23 21:25:05 +0000534
535The name of the DLL must match the Tcl version Vim was compiled with.
Bram Moolenaarfa735342016-01-03 22:14:44 +0100536Currently the name is "tcl86.dll". That is for Tcl 8.6. To know for sure
Bram Moolenaara5792f52005-11-23 21:25:05 +0000537edit "gvim.exe" and search for "tcl\d*.dll\c".
538
Bram Moolenaar8a5115c2016-01-09 19:41:11 +0100539
540Unix ~
541
542The 'tcldll' option can be used to specify the Tcl shared library file instead
543of DYNAMIC_TCL_DLL file what was specified at compile time. The version of
544the shared library must match the Tcl version Vim was compiled with.
545
Bram Moolenaara5792f52005-11-23 21:25:05 +0000546==============================================================================
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200547 vim:tw=78:ts=8:noet:ft=help:norl: