Nvim:help pages,generated fromsource using thetree-sitter-vimdoc parser.
{cmd}Execute Ruby command{cmd}. A command to try it out::ruby print "Hello":rub[y] << [trim] [
{endmarker}]{script}{endmarker}Execute Ruby script{script}.function! RedGem()ruby << EOFclass Garnet def initialize(s) @buffer = VIM::Buffer.current vimputs(s) end def vimputs(s) @buffer.append(@buffer.count,s) endendgem = Garnet.new("pretty")EOFendfunction:ruby print RUBY_VERSION
{cmd}Evaluate Ruby command{cmd} for each line in the[range], with $_ being set to the text of each line inturn, without a trailing<EOL>. Setting $_ willchange the text, but note that it is not possible toadd or delete lines using this command.The default for [range] is the whole file: "1,$".{file}Execute the Ruby script in{file}. This is the sameas:ruby load 'file', but allows file name completion.print "Hello" # displays a messageVIM.command(cmd) # execute an Ex commandnum = VIM::Window.count # gets the number of windowsw = VIM::Window[n] # gets window "n"cw = VIM::Window.current # gets the current windownum = VIM::Buffer.count # gets the number of buffersb = VIM::Buffer[n] # gets buffer "n"cb = VIM::Buffer.current # gets the current bufferw.height = lines # sets the window heightw.cursor = [row, col] # sets the window cursor positionpos = w.cursor # gets an array [row, col]name = b.name # gets the buffer file nameline = b[n] # gets a line from the buffernum = b.count # gets the number of linesb[n] = str # sets a line in the bufferb.delete(n) # deletes a lineb.append(n, str) # appends a line after nline = VIM::Buffer.current.line # gets the current linenum = VIM::Buffer.current.line_number # gets the current line numberVIM::Buffer.current.line = "test" # sets the current line number
{arg})Sets a vim option.{arg} can be any argument that the ":set" commandaccepts. Note that this means that no spaces are allowed in theargument! See:set.{expr})Evaluates{expr} using the vim internal expression evaluator (seeexpression). Returns the expression result as a string.AList is turned into a string by joining the items and insertingline breaks.{n}]Returns the buffer object for the number{n}. The firstnumber is 0.{n}]Returns a line from the buffer.{n} is the line number.self[{n}] ={str}Sets a line in the buffer.{n} is the line number.delete({n})Deletes a line from the buffer.{n} is the line number.append({n},{str})Appends a line after the line{n}.lineReturns the current line of the buffer if the buffer isactive.line ={str} Sets the current line of the buffer if the buffer is active.line_number Returns the number of the current line if the buffer isactive.{n}]Returns the window object for the number{n}. The firstnumber is 0.{n}Sets the window height to{n}.widthReturns the width of the window.width ={n}Sets the window width to{n}.cursorReturns a [row, col] array for the cursor position.First line number is 1 and first column number is 0.cursor = [{row},{col}]Sets the cursor position to{row} and{col}.