annotate runtime/doc/if_ruby.txt @ 33901:6732325893cc

runtime(doc): Update eval.txt (#13645) Commit: https://github.com/vim/vim/commit/c23fc364766ced611b22ae9e787f1455ecf7e271 Author: K.Takata <kentkt@csc.jp> Date: Sat Dec 9 05:51:04 2023 +0900 runtime(doc): Update eval.txt (https://github.com/vim/vim/issues/13645) expr5 is also expr6 itself. Signed-off-by: K.Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Dec 2023 15:16:35 +0100
parents f8116058ca76
children 4635e43f2c6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29314
f8116058ca76 release version 9.0
Bram Moolenaar <Bram@vim.org>
parents: 20045
diff changeset
1 *if_ruby.txt* For Vim version 9.0. Last change: 2019 Jul 21
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 VIM REFERENCE MANUAL by Shugo Maeda
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 The Ruby Interface to Vim *ruby* *Ruby*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 1. Commands |ruby-commands|
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
10 2. The Vim module |ruby-vim|
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
11 3. Vim::Buffer objects |ruby-buffer|
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
12 4. Vim::Window objects |ruby-window|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 5. Global variables |ruby-globals|
16103
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
14 6. rubyeval() Vim function |ruby-rubyeval|
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
15 7. Dynamic loading |ruby-dynamic|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 *E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
16553
0e473e9e70c2 patch 8.1.1280: remarks about functionality not in Vi clutters the help
Bram Moolenaar <Bram@vim.org>
parents: 16103
diff changeset
19 {only available when Vim was compiled with the |+ruby| feature}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 The home page for ruby is http://www.ruby-lang.org/. You can find links for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 downloading Ruby there.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 1. Commands *ruby-commands*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 *:ruby* *:rub*
3750
536aa8b0c934 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2625
diff changeset
28 :rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: >
536aa8b0c934 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2625
diff changeset
29 :ruby print "Hello"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
31 :rub[y] << [trim] [{endmarker}]
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 {script}
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
33 {endmarker}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 Execute Ruby script {script}.
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
35
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
36 If [endmarker] is omitted, it defaults to a dot '.'
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
37 like for the |:append| and |:insert| commands. Refer
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
38 to |: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
39
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
40
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
41 This form of the |:ruby| command is mainly useful for
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 including ruby code in vim scripts.
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
43
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 Note: This command doesn't work when the Ruby feature
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 wasn't compiled in. To avoid errors, see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 |script-here|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 Example Vim script: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 function! RedGem()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 ruby << EOF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 class Garnet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 def initialize(s)
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
54 @buffer = Vim::Buffer.current
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 vimputs(s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 def vimputs(s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 @buffer.append(@buffer.count,s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 gem = Garnet.new("pretty")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 EOF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 <
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
65 To see what version of Ruby you have: >
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
66 :ruby print RUBY_VERSION
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
67 <
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 *:rubydo* *:rubyd* *E265*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 :[range]rubyd[o] {cmd} Evaluate Ruby command {cmd} for each line in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 [range], with $_ being set to the text of each line in
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 7
diff changeset
72 turn, without a trailing <EOL>. Setting $_ will change
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 the text, but note that it is not possible to add or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 delete lines using this command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 The default for [range] is the whole file: "1,$".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 *:rubyfile* *:rubyf*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 :rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as
11062
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 10244
diff changeset
79 `:ruby load 'file'`, but allows file name completion.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 Executing Ruby commands is not possible in the |sandbox|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 ==============================================================================
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
84 2. The Vim module *ruby-vim*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
86 Ruby code gets all of its access to vim via the "Vim" module.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
88 Overview: >
809
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
89 print "Hello" # displays a message
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
90 Vim.command(cmd) # execute an Ex command
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
91 num = Vim::Window.count # gets the number of windows
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
92 w = Vim::Window[n] # gets window "n"
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
93 cw = Vim::Window.current # gets the current window
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
94 num = Vim::Buffer.count # gets the number of buffers
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
95 b = Vim::Buffer[n] # gets buffer "n"
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
96 cb = Vim::Buffer.current # gets the current buffer
809
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
97 w.height = lines # sets the window height
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
98 w.cursor = [row, col] # sets the window cursor position
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
99 pos = w.cursor # gets an array [row, col]
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
100 name = b.name # gets the buffer file name
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
101 line = b[n] # gets a line from the buffer
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
102 num = b.count # gets the number of lines
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
103 b[n] = str # sets a line in the buffer
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
104 b.delete(n) # deletes a line
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
105 b.append(n, str) # appends a line after n
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
106 line = Vim::Buffer.current.line # gets the current line
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
107 num = Vim::Buffer.current.line_number # gets the current line number
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
108 Vim::Buffer.current.line = "test" # sets the current line number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 Module Functions:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 *ruby-message*
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
114 Vim::message({msg})
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 Displays the message {msg}.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
15454
1d2b5c016f17 patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
117 *ruby-blob*
1d2b5c016f17 patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
118 Vim::blob({arg})
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15454
diff changeset
119 Return |Blob| literal string from {arg}.
15454
1d2b5c016f17 patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
120
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 *ruby-set_option*
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
122 Vim::set_option({arg})
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 Sets a vim option. {arg} can be any argument that the ":set" command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 accepts. Note that this means that no spaces are allowed in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 argument! See |:set|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 *ruby-command*
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
128 Vim::command({cmd})
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 Executes Ex command {cmd}.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 *ruby-evaluate*
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
132 Vim::evaluate({expr})
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 Evaluates {expr} using the vim internal expression evaluator (see
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
134 |expression|). Returns the expression result as:
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
135 - a Integer if the Vim expression evaluates to a number
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
136 - a Float if the Vim expression evaluates to a float
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
137 - a String if the Vim expression evaluates to a string
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
138 - a Array if the Vim expression evaluates to a Vim list
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
139 - a Hash if the Vim expression evaluates to a Vim dictionary
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
140 Dictionaries and lists are recursively expanded.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 ==============================================================================
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
143 3. Vim::Buffer objects *ruby-buffer*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
145 Vim::Buffer objects represent vim buffers.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 Class Methods:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 current Returns the current buffer object.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 count Returns the number of buffers.
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 7
diff changeset
151 self[{n}] Returns the buffer object for the number {n}. The first number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 is 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 Methods:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
14413
c3b62844ee4e patch 8.1.0221: not enough testing for the Ruby interface
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
156 name Returns the full name of the buffer.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 number Returns the number of the buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 count Returns the number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 length Returns the number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 self[{n}] Returns a line from the buffer. {n} is the line number.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 self[{n}] = {str}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 Sets a line in the buffer. {n} is the line number.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 delete({n}) Deletes a line from the buffer. {n} is the line number.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 append({n}, {str})
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 Appends a line after the line {n}.
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
166 line Returns the current line of the buffer if the buffer is
809
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
167 active.
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
168 line = {str} Sets the current line of the buffer if the buffer is active.
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
169 line_number Returns the number of the current line if the buffer is
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 799
diff changeset
170 active.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 ==============================================================================
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
173 4. Vim::Window objects *ruby-window*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
7315
444efa5f5015 commit https://github.com/vim/vim/commit/2c5e8e80eacf491d4f266983f534a77776c7ae83
Christian Brabandt <cb@256bit.org>
parents: 7196
diff changeset
175 Vim::Window objects represent vim windows.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 Class Methods:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 current Returns the current window object.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 count Returns the number of windows.
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 7
diff changeset
181 self[{n}] Returns the window object for the number {n}. The first number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 is 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 Methods:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 buffer Returns the buffer displayed in the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 height Returns the height of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 height = {n} Sets the window height to {n}.
502
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 236
diff changeset
189 width Returns the width of the window.
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 236
diff changeset
190 width = {n} Sets the window width to {n}.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 cursor Returns a [row, col] array for the cursor position.
14413
c3b62844ee4e patch 8.1.0221: not enough testing for the Ruby interface
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
192 First line number is 1 and first column number is 0.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 cursor = [{row}, {col}]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 Sets the cursor position to {row} and {col}.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 ==============================================================================
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
197 5. Global variables *ruby-globals*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 There are two global variables.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 $curwin The current window object.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 $curbuf The current buffer object.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 ==============================================================================
16103
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
205 6. rubyeval() Vim function *ruby-rubyeval*
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
206
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
207 To facilitate bi-directional interface, you can use |rubyeval()| function to
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
208 evaluate Ruby expressions and pass their values to Vim script.
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
209
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
210 The Ruby value "true", "false" and "nil" are converted to v:true, v:false and
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
211 v:null, respectively.
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
212
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
213 ==============================================================================
518f44125207 patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
214 7. Dynamic loading *ruby-dynamic*
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
215
2625
0aa21d63aba0 Updated runtile files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
216 On MS-Windows and Unix the Ruby library can be loaded dynamically. The
0aa21d63aba0 Updated runtile files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
217 |:version| output then includes |+ruby/dyn|.
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
218
2625
0aa21d63aba0 Updated runtile files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
219 This means that Vim will search for the Ruby DLL file or shared library only
0aa21d63aba0 Updated runtile files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
220 when needed. When you don't use the Ruby interface you don't need it, thus
0aa21d63aba0 Updated runtile files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
221 you can use Vim even though this library file is not on your system.
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
222
8673
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7315
diff changeset
223
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
224 MS-Windows ~
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
225
2342
f6540762173d Fixes and improvements for MS-Windows build.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
226 You need to install the right version of Ruby for this to work. You can find
f6540762173d Fixes and improvements for MS-Windows build.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
227 the package to download from:
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
228 http://rubyinstaller.org/downloads/
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
229 Currently that is rubyinstaller-2.2.5.exe
2342
f6540762173d Fixes and improvements for MS-Windows build.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
230
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
231 To use the Ruby interface the Ruby DLL must be in your search path. In a
8673
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7315
diff changeset
232 console window type "path" to see what directories are used. The 'rubydll'
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7315
diff changeset
233 option can be also used to specify the Ruby DLL.
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
234
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
235 The name of the DLL must match the Ruby version Vim was compiled with.
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
236 Currently the name is "msvcrt-ruby220.dll". That is for Ruby 2.2.X. To know
2342
f6540762173d Fixes and improvements for MS-Windows build.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
237 for sure edit "gvim.exe" and search for "ruby\d*.dll\c".
f6540762173d Fixes and improvements for MS-Windows build.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
238
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
239 If you want to build Vim with RubyInstaller 1.9 or 2.X using MSVC, you need
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
240 some tricks. See the src/INSTALLpc.txt for detail.
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
241
13482
9eebe457eb3c Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
242 If Vim is built with RubyInstaller 2.4 or later, you may also need to add
9eebe457eb3c Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
243 "C:\Ruby<version>\bin\ruby_builtin_dlls" to the PATH environment variable.
9eebe457eb3c Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
244
8673
ed7251c3e2d3 commit https://github.com/vim/vim/commit/e18c0b39815c5a746887a509c2cd9f11fadaba07
Christian Brabandt <cb@256bit.org>
parents: 7315
diff changeset
245
7196
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
246 Unix ~
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
247
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
248 The 'rubydll' option can be used to specify the Ruby shared library file
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
249 instead of DYNAMIC_RUBY_DLL file what was specified at compile time. The
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
250 version of the shared library must match the Ruby version Vim was compiled
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
251 with.
42717d048817 commit https://github.com/vim/vim/commit/d94464ee294a351ce7b6ba18e8bd3f24f1bef920
Christian Brabandt <cb@256bit.org>
parents: 6647
diff changeset
252
557
862863033fdd updated for version 7.0158
vimboss
parents: 502
diff changeset
253 ==============================================================================
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14413
diff changeset
254 vim:tw=78:ts=8:noet:ft=help:norl: