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