annotate runtime/doc/if_mzsch.txt @ 22355:0491b9cafd44 v8.2.1726

patch 8.2.1726: fuzzy matching only works on strings Commit: https://github.com/vim/vim/commit/4f73b8e9cc83f647b34002554a8bdf9abec0a82f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 22 20:33:50 2020 +0200 patch 8.2.1726: fuzzy matching only works on strings Problem: Fuzzy matching only works on strings. Solution: Support passing a dict. Add matchfuzzypos() to also get the match positions. (Yegappan Lakshmanan, closes #6947)
author Bram Moolenaar <Bram@vim.org>
date Tue, 22 Sep 2020 20:45:04 +0200
parents 04ef2ccf2519
children 5b7ea82bc18f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18879
af69c9335223 Vim 8.2 release
Bram Moolenaar <Bram@vim.org>
parents: 18831
diff changeset
1 *if_mzsch.txt* For Vim version 8.2. Last change: 2019 Dec 07
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
2
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
3
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
4 VIM REFERENCE MANUAL by Sergey Khorev
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
5
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
6
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
7 The MzScheme Interface to Vim *mzscheme* *MzScheme*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
8
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
9 1. Commands |mzscheme-commands|
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
10 2. Examples |mzscheme-examples|
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
11 3. Threads |mzscheme-threads|
2050
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
12 4. Vim access from MzScheme |mzscheme-vim|
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
13 5. mzeval() Vim function |mzscheme-mzeval|
4074
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
14 6. Using Function references |mzscheme-funcref|
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
15 7. Dynamic loading |mzscheme-dynamic|
7609
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
16 8. MzScheme setup |mzscheme-setup|
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
17
16553
0e473e9e70c2 patch 8.1.1280: remarks about functionality not in Vi clutters the help
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
18 {only available when Vim was compiled with the |+mzscheme| feature}
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
19
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
20 Based on the work of Brent Fulgham.
128
8def260d486d updated for version 7.0044
vimboss
parents: 26
diff changeset
21 Dynamic loading added by Sergey Khorev
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
22
4074
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
23 MzScheme and PLT Scheme names have been rebranded as Racket. For more
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
24 information please check http://racket-lang.org
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
25
4074
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
26 Futures and places of Racket version 5.x up to and including 5.3.1 do not
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
27 work correctly with processes created by Vim.
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
28 The simplest solution is to build Racket on your own with these features
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
29 disabled: >
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
30 ./configure --disable-futures --disable-places --prefix=your-install-prefix
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
31
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
32 To speed up the process, you might also want to use --disable-gracket and
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
33 --disable-docs
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
34
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
35 ==============================================================================
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
36 1. Commands *mzscheme-commands*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
37
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
38 *:mzscheme* *:mz*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
39 :[range]mz[scheme] {stmt}
16553
0e473e9e70c2 patch 8.1.1280: remarks about functionality not in Vi clutters the help
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
40 Execute MzScheme statement {stmt}.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
41
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
42 :[range]mz[scheme] << [trim] [{endmarker}]
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
43 {script}
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
44 {endmarker}
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
45 Execute inlined MzScheme script {script}.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
46 Note: This command doesn't work if the MzScheme
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
47 feature wasn't compiled in. To avoid errors, see
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
48 |script-here|.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
49
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
50 If [endmarker] is omitted from after the "<<", a dot
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
51 '.' must be used after {script}, like for the
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
52 |:append| and |:insert| commands. Refer to
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
53 |:let-heredoc| for more information.
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
54
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
55
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
56 *:mzfile* *:mzf*
16553
0e473e9e70c2 patch 8.1.1280: remarks about functionality not in Vi clutters the help
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
57 :[range]mzf[ile] {file} Execute the MzScheme script in {file}.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
58
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
59 All of these commands do essentially the same thing - they execute a piece of
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
60 MzScheme code, with the "current range" set to the given line
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
61 range.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
62
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
63 In the case of :mzscheme, the code to execute is in the command-line.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
64 In the case of :mzfile, the code to execute is the contents of the given file.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
65
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
66 MzScheme interface defines exception exn:vim, derived from exn.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
67 It is raised for various Vim errors.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
68
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
69 During compilation, the MzScheme interface will remember the current MzScheme
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
70 collection path. If you want to specify additional paths use the
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
71 'current-library-collection-paths' parameter. E.g., to cons the user-local
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
72 MzScheme collection path: >
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
73 :mz << EOF
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
74 (current-library-collection-paths
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
75 (cons
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
76 (build-path (find-system-path 'addon-dir) (version) "collects")
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
77 (current-library-collection-paths)))
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
78 EOF
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
79 <
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
80
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
81 All functionality is provided through module vimext.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
82
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
83 The exn:vim is available without explicit import.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
84
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
85 To avoid clashes with MzScheme, consider using prefix when requiring module,
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
86 e.g.: >
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
87 :mzscheme (require (prefix vim- vimext))
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
88 <
18831
6848b809a26e Runtime file updates.
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
89 All the examples below assume this naming scheme.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
90
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 128
diff changeset
91 *mzscheme-sandbox*
2463194c8cdd updated for version 7.0073
vimboss
parents: 128
diff changeset
92 When executed in the |sandbox|, access to some filesystem and Vim interface
2463194c8cdd updated for version 7.0073
vimboss
parents: 128
diff changeset
93 procedures is restricted.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
94
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
95 ==============================================================================
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
96 2. Examples *mzscheme-examples*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
97 >
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
98 :mzscheme (display "Hello")
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
99 :mz (display (string-append "Using MzScheme version " (version)))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
100 :mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
101 :mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
102 :mzscheme (vim-set-buff-line 10 "This is line #10")
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 7742
diff changeset
103
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 7742
diff changeset
104 To see what version of MzScheme you have: >
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 7742
diff changeset
105 :mzscheme (display (version))
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
106 <
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
107 Inline script usage: >
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
108 function! <SID>SetFirstLine()
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
109 :mz << EOF
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
110 (display "!!!")
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
111 (require (prefix vim- vimext))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
112 ; for newer versions (require (prefix-in vim- 'vimext))
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
113 (vim-set-buff-line 1 "This is line #1")
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
114 (vim-beep)
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
115 EOF
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
116 endfunction
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
117
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
118 nmap <F9> :call <SID>SetFirstLine() <CR>
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
119 <
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
120 File execution: >
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
121 :mzfile supascript.scm
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
122 <
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
123 Vim exception handling: >
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
124 :mz << EOF
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
125 (require (prefix vim- vimext))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
126 ; for newer versions (require (prefix-in vim- 'vimext))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
127 (with-handlers
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
128 ([exn:vim? (lambda (e) (display (exn-message e)))])
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
129 (vim-eval "nonsense-string"))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
130 EOF
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
131 <
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
132 Auto-instantiation of vimext module (can be placed in your |vimrc|): >
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
133 function! MzRequire()
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
134 :redir => l:mzversion
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
135 :mz (version)
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
136 :redir END
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
137 if strpart(l:mzversion, 1, 1) < "4"
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
138 " MzScheme versions < 4.x:
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
139 :mz (require (prefix vim- vimext))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
140 else
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
141 " newer versions:
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
142 :mz (require (prefix-in vim- 'vimext))
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
143 endif
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
144 endfunction
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
145
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
146 if has("mzscheme")
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
147 silent call MzRequire()
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
148 endif
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
149 <
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
150 ==============================================================================
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
151 3. Threads *mzscheme-threads*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
152
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
153 The MzScheme interface supports threads. They are independent from OS threads,
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
154 thus scheduling is required. The option 'mzquantum' determines how often
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
155 Vim should poll for available MzScheme threads.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
156 NOTE
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
157 Thread scheduling in the console version of Vim is less reliable than in the
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
158 GUI version.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
159
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
160 ==============================================================================
2050
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
161 4. Vim access from MzScheme *mzscheme-vim*
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
162
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
163 *mzscheme-vimext*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
164 The 'vimext' module provides access to procedures defined in the MzScheme
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
165 interface.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
166
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
167 Common
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
168 ------
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
169 (command {command-string}) Perform the vim ":Ex" style command.
1894
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
170 (eval {expr-string}) Evaluate the vim expression into
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
171 respective MzScheme object: |Lists| are
afb740b5dfab updated for version 7.2-191
vimboss
parents: 1702
diff changeset
172 represented as Scheme lists,
4074
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
173 |Dictionaries| as hash tables,
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
174 |Funcref|s as functions (see also
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
175 |mzscheme-funcref|)
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
176 NOTE the name clashes with MzScheme eval,
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
177 use module qualifiers to overcome this.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
178 (range-start) Start/End of the range passed with
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
179 (range-end) the Scheme command.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
180 (beep) beep
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
181 (get-option {option-name} [buffer-or-window]) Get Vim option value (either
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
182 local or global, see set-option).
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
183 (set-option {string} [buffer-or-window])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
184 Set a Vim option. String must have option
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
185 setting form (like optname=optval, or
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
186 optname+=optval, etc.) When called with
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
187 {buffer} or {window} the local option will
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
188 be set. The symbol 'global can be passed
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
189 as {buffer-or-window}. Then |:setglobal|
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
190 will be used.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
191
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
192 Buffers *mzscheme-buffer*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
193 -------
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
194 (buff? {object}) Is object a buffer?
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
195 (buff-valid? {object}) Is object a valid buffer? (i.e.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
196 corresponds to the real Vim buffer)
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
197 (get-buff-line {linenr} [buffer])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
198 Get line from a buffer.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
199 (set-buff-line {linenr} {string} [buffer])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
200 Set a line in a buffer. If {string} is #f,
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
201 the line gets deleted. The [buffer]
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
202 argument is optional. If omitted, the
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
203 current buffer will be used.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
204 (get-buff-line-list {start} {end} [buffer])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
205 Get a list of lines in a buffer. {Start}
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2050
diff changeset
206 and {end} are 1-based and inclusive.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
207 (set-buff-line-list {start} {end} {string-list} [buffer])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
208 Set a list of lines in a buffer. If
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
209 string-list is #f or null, the lines get
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
210 deleted. If a list is shorter than
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
211 {end}-{start} the remaining lines will
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
212 be deleted.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
213 (get-buff-name [buffer]) Get a buffer's text name.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
214 (get-buff-num [buffer]) Get a buffer's number.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
215 (get-buff-size [buffer]) Get buffer line count.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
216 (insert-buff-line-list {linenr} {string/string-list} [buffer])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
217 Insert a list of lines into a buffer after
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
218 {linenr}. If {linenr} is 0, lines will be
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
219 inserted at start.
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2050
diff changeset
220 (curr-buff) Get the current buffer. Use other MzScheme
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2050
diff changeset
221 interface procedures to change it.
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
222 (buff-count) Get count of total buffers in the editor.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
223 (get-next-buff [buffer]) Get next buffer.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
224 (get-prev-buff [buffer]) Get previous buffer. Return #f when there
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
225 are no more buffers.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
226 (open-buff {filename}) Open a new buffer (for file "name")
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
227 (get-buff-by-name {buffername}) Get a buffer by its filename or #f
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
228 if there is no such buffer.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
229 (get-buff-by-num {buffernum}) Get a buffer by its number (return #f if
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
230 there is no buffer with this number).
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
231
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
232 Windows *mzscheme-window*
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
233 ------
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
234 (win? {object}) Is object a window?
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
235 (win-valid? {object}) Is object a valid window (i.e. corresponds
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
236 to the real Vim window)?
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
237 (curr-win) Get the current window.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
238 (win-count) Get count of windows.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
239 (get-win-num [window]) Get window number.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
240 (get-win-by-num {windownum}) Get window by its number.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
241 (get-win-buffer [window]) Get the buffer for a given window.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
242 (get-win-height [window])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
243 (set-win-height {height} [window]) Get/Set height of window.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
244 (get-win-width [window])
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
245 (set-win-width {width} [window])Get/Set width of window.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
246 (get-win-list [buffer]) Get list of windows for a buffer.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
247 (get-cursor [window]) Get cursor position in a window as
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
248 a pair (linenr . column).
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
249 (set-cursor (line . col) [window]) Set cursor position.
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
250
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
251 ==============================================================================
2050
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
252 5. mzeval() Vim function *mzscheme-mzeval*
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
253
2249
6d3d35ff2c2b Use full path in undofile(). Updated docs.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
254 To facilitate bi-directional interface, you can use |mzeval()| function to
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
255 evaluate MzScheme expressions and pass their values to Vim script.
2050
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
256
afcf9db31561 updated for version 7.2.336
Bram Moolenaar <bram@zimbu.org>
parents: 1919
diff changeset
257 ==============================================================================
4074
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
258 6. Using Function references *mzscheme-funcref*
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
259
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
260 MzScheme interface allows use of |Funcref|s so you can call Vim functions
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
261 directly from Scheme. For instance: >
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
262 function! MyAdd2(arg)
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
263 return a:arg + 2
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
264 endfunction
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
265 mz (define f2 (vim-eval "function(\"MyAdd2\")"))
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
266 mz (f2 7)
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
267 < or : >
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
268 :mz (define indent (vim-eval "function('indent')"))
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
269 " return Vim indent for line 12
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
270 :mz (indent 12)
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
271 <
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
272
16e8a09e8ab0 updated for version 7.3.791
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
273 ==============================================================================
7742
5f6f35a3cb12 commit https://github.com/vim/vim/commit/705ada1aff27ecd9c47c690df817d043c2ceb5e2
Christian Brabandt <cb@256bit.org>
parents: 7659
diff changeset
274 7. Dynamic loading *mzscheme-dynamic* *E815*
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
275
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
276 On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
277 output then includes |+mzscheme/dyn|.
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
278
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
279 This means that Vim will search for the MzScheme DLL files only when needed.
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
280 When you don't use the MzScheme interface you don't need them, thus you can
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
281 use Vim without these DLL files.
7609
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
282 NOTE: Newer version of MzScheme (Racket) require earlier (trampolined)
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
283 initialisation via scheme_main_setup. So Vim always loads the MzScheme DLL at
12608
b390f5003e2f patch 8.0.1182: cannot see or change mzscheme dll name
Christian Brabandt <cb@256bit.org>
parents: 10942
diff changeset
284 startup if possible. This may make Vim startup slower.
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
285
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
286 To use the MzScheme interface the MzScheme DLLs must be in your search path.
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
287 In a console window type "path" to see what directories are used.
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
288
12608
b390f5003e2f patch 8.0.1182: cannot see or change mzscheme dll name
Christian Brabandt <cb@256bit.org>
parents: 10942
diff changeset
289 On MS-Windows the options 'mzschemedll' and 'mzschemegcdll' are used for the
b390f5003e2f patch 8.0.1182: cannot see or change mzscheme dll name
Christian Brabandt <cb@256bit.org>
parents: 10942
diff changeset
290 name of the library to load. The initial value is specified at build time.
b390f5003e2f patch 8.0.1182: cannot see or change mzscheme dll name
Christian Brabandt <cb@256bit.org>
parents: 10942
diff changeset
291
b390f5003e2f patch 8.0.1182: cannot see or change mzscheme dll name
Christian Brabandt <cb@256bit.org>
parents: 10942
diff changeset
292 The version of the DLL must match the MzScheme version Vim was compiled with.
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
293 For MzScheme version 209 they will be "libmzsch209_000.dll" and
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
294 "libmzgc209_000.dll". To know for sure look at the output of the ":version"
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
295 command, look for -DDYNAMIC_MZSCH_DLL="something" and
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
296 -DDYNAMIC_MZGC_DLL="something" in the "Compilation" info.
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 273
diff changeset
297
7609
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
298 For example, if MzScheme (Racket) is installed at C:\Racket63, you may need
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
299 to set the environment variable as the following: >
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
300
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
301 PATH=%PATH%;C:\Racket63\lib
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
302 PLTCOLLECTS=C:\Racket63\collects
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
303 PLTCONFIGDIR=C:\Racket63\etc
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
304 <
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
305 ==============================================================================
7742
5f6f35a3cb12 commit https://github.com/vim/vim/commit/705ada1aff27ecd9c47c690df817d043c2ceb5e2
Christian Brabandt <cb@256bit.org>
parents: 7659
diff changeset
306 8. MzScheme setup *mzscheme-setup* *E895*
7609
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
307
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
308 Vim requires "racket/base" module for if_mzsch core (fallback to "scheme/base"
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
309 if it doesn't exist), "r5rs" module for test and "raco ctool" command for
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
310 building Vim. If MzScheme did not have them, you can install them with
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
311 MzScheme's raco command:
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
312 >
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
313 raco pkg install scheme-lib # scheme/base module
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
314 raco pkg install r5rs-lib # r5rs module
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
315 raco pkg install cext-lib # raco ctool command
77a14f3bc18b commit https://github.com/vim/vim/commit/4e640bd930d133889dbc9f9a77e29bab902e3b7d
Christian Brabandt <cb@256bit.org>
parents: 5294
diff changeset
316 <
14
946da5994c01 updated for version 7.0006
vimboss
parents:
diff changeset
317 ======================================================================
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
318 vim:tw=78:ts=8:noet:sts=4:ft=help:norl: