Home Explore Blog CI



neovim

44th chunk of `runtime/doc/vimfn.txt`
1451f0e55547a509af59a49b0341a7c47d609b776d7469cf0000000100000fb0
 0, 3]
<

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

                Return: ~
                  (`any`)

getcwd([{winnr} [, {tabnr}]])                                         *getcwd()*
		With no arguments, returns the name of the effective
		|current-directory|. With {winnr} or {tabnr} the working
		directory of that scope is returned, and 'autochdir' is
		ignored.
		Tabs and windows are identified by their respective numbers,
		0 means current tab or window. Missing tab number implies 0.
		Thus the following are equivalent: >vim
			getcwd(0)
			getcwd(0, 0)
<		If {winnr} is -1 it is ignored, only the tab is resolved.
		{winnr} can be the window number or the |window-ID|.
		If both {winnr} and {tabnr} are -1 the global working
		directory is returned.
		Throw error if the arguments are invalid. |E5000| |E5001| |E5002|

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

                Return: ~
                  (`string`)

getenv({name})                                                        *getenv()*
		Return the value of environment variable {name}.  The {name}
		argument is a string, without a leading '$'.  Example: >vim
			myHome = getenv('HOME')

<		When the variable does not exist |v:null| is returned.  That
		is different from a variable set to an empty string.
		See also |expr-env|.

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

                Return: ~
                  (`string`)

getfontname([{name}])                                            *getfontname()*
		Without an argument returns the name of the normal font being
		used.  Like what is used for the Normal highlight group
		|hl-Normal|.
		With an argument a check is done whether String {name} is a
		valid font name.  If not then an empty string is returned.
		Otherwise the actual font name is returned, or {name} if the
		GUI does not support obtaining the real name.
		Only works when the GUI is running, thus not in your vimrc or
		gvimrc file.  Use the |GUIEnter| autocommand to use this
		function just after the GUI has started.

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

                Return: ~
                  (`string`)

getfperm({fname})                                                   *getfperm()*
		The result is a String, which is the read, write, and execute
		permissions of the given file {fname}.
		If {fname} does not exist or its directory cannot be read, an
		empty string is returned.
		The result is of the form "rwxrwxrwx", where each group of
		"rwx" flags represent, in turn, the permissions of the owner
		of the file, the group the file belongs to, and other users.
		If a user does not have a given permission the flag for this
		is replaced with the string "-".  Examples: >vim
			echo getfperm("/etc/passwd")
			echo getfperm(expand("~/.config/nvim/init.vim"))
<		This will hopefully (from a security point of view) display
		the string "rw-r--r--" or even "rw-------".

		For setting permissions use |setfperm()|.

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

                Return: ~
                  (`string`)

getfsize({fname})                                                   *getfsize()*
		The result is a Number, which is the size in bytes of the
		given file {fname}.
		If {fname} is a directory, 0 is returned.
		If the file {fname} can't be found, -1 is returned.
		If the size of {fname} is too big to fit in a Number then -2
		is returned.

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

                Return: ~
                  (`integer`)

getftime({fname})                                                   *getftime()*
		The result is a Number, which is the last modification time of
		the given file {fname}.  The value is measured as seconds
		since 1st Jan 1970, and may be passed to strftime().  See also
		|localtime()| and |strftime()|.
		If the

Title: Vimscript: getcwd(), getenv(), getfontname(), getfperm(), getfsize(), and getftime()
Summary
This section describes several Vimscript functions for retrieving system information. getcwd() returns the current working directory, optionally for a specific window or tab. getenv() retrieves the value of an environment variable. getfontname() returns the name of the font being used. getfperm() returns a string representing the file permissions of a file. getfsize() returns the size of a file in bytes. getftime() returns the last modification time of a file as seconds since January 1, 1970.