Home Explore Blog CI



neovim

32th chunk of `runtime/doc/vimfn.txt`
995eb5c73ade94073d5fb12e19a366a7c4022932be4566820000000100000fb0
 magnitude of {expr2}.  If {expr2} is zero, the value
		returned is zero.  The value returned is a |Float|.
		{expr1} and {expr2} must evaluate to a |Float| or a |Number|.
		Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
		|Number|.
		Examples: >vim
			echo fmod(12.33, 1.22)
<			0.13 >vim
			echo fmod(-12.33, 1.22)
<			-0.13

                Parameters: ~
                  • {expr1} (`number`)
                  • {expr2} (`number`)

                Return: ~
                  (`any`)

fnameescape({string})                                            *fnameescape()*
		Escape {string} for use as file name command argument.  All
		characters that have a special meaning, such as `'%'` and `'|'`
		are escaped with a backslash.
		For most systems the characters escaped are
		" \t\n*?[{`$\\%#'\"|!<".  For systems where a backslash
		appears in a filename, it depends on the value of 'isfname'.
		A leading '+' and '>' is also escaped (special after |:edit|
		and |:write|).  And a "-" by itself (special after |:cd|).
		Returns an empty string on error.
		Example: >vim
			let fname = '+some str%nge|name'
			exe "edit " .. fnameescape(fname)
<		results in executing: >vim
			edit \+some\ str\%nge\|name
<

                Parameters: ~
                  • {string} (`string`)

                Return: ~
                  (`string`)

fnamemodify({fname}, {mods})                                     *fnamemodify()*
		Modify file name {fname} according to {mods}.  {mods} is a
		string of characters like it is used for file names on the
		command line.  See |filename-modifiers|.
		Example: >vim
			echo fnamemodify("main.c", ":p:h")
<		results in: >
			/home/user/vim/vim/src
<		If {mods} is empty or an unsupported modifier is used then
		{fname} is returned.
		When {fname} is empty then with {mods} ":h" returns ".", so
		that `:cd` can be used with it.  This is different from
		expand('%:h') without a buffer name, which returns an empty
		string.
		Note: Environment variables don't work in {fname}, use
		|expand()| first then.

                Parameters: ~
                  • {fname} (`string`)
                  • {mods} (`string`)

                Return: ~
                  (`string`)

foldclosed({lnum})                                                *foldclosed()*
		The result is a Number.  If the line {lnum} is in a closed
		fold, the result is the number of the first line in that fold.
		If the line {lnum} is not in a closed fold, -1 is returned.
		{lnum} is used like with |getline()|.  Thus "." is the current
		line, "'m" mark m, etc.

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

                Return: ~
                  (`integer`)

foldclosedend({lnum})                                          *foldclosedend()*
		The result is a Number.  If the line {lnum} is in a closed
		fold, the result is the number of the last line in that fold.
		If the line {lnum} is not in a closed fold, -1 is returned.
		{lnum} is used like with |getline()|.  Thus "." is the current
		line, "'m" mark m, etc.

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

                Return: ~
                  (`integer`)

foldlevel({lnum})                                                  *foldlevel()*
		The result is a Number, which is the foldlevel of line {lnum}
		in the current buffer.  For nested folds the deepest level is
		returned.  If there is no fold at line {lnum}, zero is
		returned.  It doesn't matter if the folds are open or closed.
		When used while updating folds (from 'foldexpr') -1 is
		returned for lines where folds are still to be updated and the
		foldlevel is unknown.  As a special case the level of the
		previous line is usually available.
		{lnum} is used like with |getline()|.  Thus "." is the current
		line, "'m" mark m, etc.

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

                Return: ~
                  (`integer`)

foldtext()           

Title: Vimscript Functions: `fnameescape()`, `fnamemodify()`, `foldclosed()`, `foldclosedend()`, and `foldlevel()`
Summary
This section describes the `fnameescape()` function, which escapes special characters in a string for use as a filename argument. It then explains `fnamemodify()`, which modifies a filename based on a string of modifiers. The section also covers `foldclosed()`, which returns the first line number of a closed fold containing a given line; `foldclosedend()`, which returns the last line number of a closed fold containing a given line; and `foldlevel()`, which returns the fold level of a given line.