Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/vimfn.txt`
dee63d52de67a1509254ee350ee05a6b0e4c54be5286154b0000000100000fb3

append({lnum}, {text})                                                *append()*
		When {text} is a |List|: Append each item of the |List| as a
		text line below line {lnum} in the current buffer.
		Otherwise append {text} as one text line below line {lnum} in
		the current buffer.
		Any type of item is accepted and converted to a String.
		{lnum} can be zero to insert a line before the first one.
		{lnum} is used like with |getline()|.
		Returns 1 for failure ({lnum} out of range or out of memory),
		0 for success.  When {text} is an empty list zero is returned,
		no matter the value of {lnum}.  Example: >vim
			let failed = append(line('$'), "# THE END")
			let failed = append(0, ["Chapter 1", "the beginning"])
<

                Parameters: ~
                  • {lnum} (`integer|string`)
                  • {text} (`string|string[]`)

                Return: ~
                  (`0|1`)

appendbufline({buf}, {lnum}, {text})                           *appendbufline()*
		Like |append()| but append the text in buffer {expr}.

		This function works only for loaded buffers. First call
		|bufload()| if needed.

		For the use of {buf}, see |bufname()|.

		{lnum} is the line number to append below.  Note that using
		|line()| would use the current buffer, not the one appending
		to.  Use "$" to append at the end of the buffer.  Other string
		values are not supported.

		On success 0 is returned, on failure 1 is returned.

		If {buf} is not a valid buffer or {lnum} is not valid, an
		error message is given. Example: >vim
			let failed = appendbufline(13, 0, "# THE START")
<		However, when {text} is an empty list then no error is given
		for an invalid {lnum}, since {lnum} isn't actually used.

                Parameters: ~
                  • {buf} (`integer|string`)
                  • {lnum} (`integer`)
                  • {text} (`string`)

                Return: ~
                  (`0|1`)

argc([{winid}])                                                         *argc()*
		The result is the number of files in the argument list.  See
		|arglist|.
		If {winid} is not supplied, the argument list of the current
		window is used.
		If {winid} is -1, the global argument list is used.
		Otherwise {winid} specifies the window of which the argument
		list is used: either the window number or the window ID.
		Returns -1 if the {winid} argument is invalid.

                Parameters: ~
                  • {winid} (`integer?`)

                Return: ~
                  (`integer`)

argidx()                                                              *argidx()*
		The result is the current index in the argument list.  0 is
		the first file.  argc() - 1 is the last one.  See |arglist|.

                Return: ~
                  (`integer`)

arglistid([{winnr} [, {tabnr}]])                                   *arglistid()*
		Return the argument list ID.  This is a number which
		identifies the argument list being used.  Zero is used for the
		global argument list.  See |arglist|.
		Returns -1 if the arguments are invalid.

		Without arguments use the current window.
		With {winnr} only use this window in the current tab page.
		With {winnr} and {tabnr} use the window in the specified tab
		page.
		{winnr} can be the window number or the |window-ID|.

                Parameters: ~
                  • {winnr} (`integer?`)
                  • {tabnr} (`integer?`)

                Return: ~
                  (`integer`)

argv([{nr} [, {winid}]])                                                *argv()*
		The result is the {nr}th file in the argument list.  See
		|arglist|.  "argv(0)" is the first one.  Example: >vim
			let i = 0
			while i < argc()
			  let f = escape(fnameescape(argv(i)), '.')
			  exe 'amenu Arg.' .. f .. ' :e ' .. f .. '<CR>'
			  let i = i + 1
			endwhile
<		Without the {nr} argument, or when {nr} is -1, a |List| with
		the whole |arglist| is returned.

		The {winid} argument specifies the window ID, see |argc()|.
		For the Vim

Title: Vimscript Built-in Functions: `appendbufline()`, `argc()`, `argidx()`, `arglistid()`, and `argv()`
Summary
This section details more Vimscript built-in functions. `appendbufline()` appends text to a specified buffer. `argc()` returns the number of files in the argument list. `argidx()` returns the current index in the argument list. `arglistid()` returns the argument list ID. `argv()` returns a specific file from the argument list or the entire list if no argument is given. Each function's syntax, parameters, return values, and usage examples are provided.