tag tags
tag_listfiles tags, file names
user user names
var user variables
If {pat} is an empty string, then all the matches are
returned. Otherwise only items matching {pat} are returned.
See |wildcards| for the use of special characters in {pat}.
If the optional {filtered} flag is set to 1, then 'wildignore'
is applied to filter the results. Otherwise all the matches
are returned. The 'wildignorecase' option always applies.
If the 'wildoptions' option contains "fuzzy", then fuzzy
matching is used to get the completion matches. Otherwise
regular expression matching is used. Thus this function
follows the user preference, what happens on the command line.
If you do not want this you can make 'wildoptions' empty
before calling getcompletion() and restore it afterwards.
If {type} is "cmdline", then the |cmdline-completion| result is
returned. For example, to complete the possible values after
a ":call" command: >vim
echo getcompletion('call ', 'cmdline')
<
If there are no matches, an empty list is returned. An
invalid value for {type} produces an error.
Parameters: ~
• {pat} (`string`)
• {type} (`string`)
• {filtered} (`boolean?`)
Return: ~
(`string[]`)
getcurpos([{winid}]) *getcurpos()*
Get the position of the cursor. This is like getpos('.'), but
includes an extra "curswant" item in the list:
[0, lnum, col, off, curswant] ~
The "curswant" number is the preferred column when moving the
cursor vertically. After |$| command it will be a very large
number equal to |v:maxcol|. Also see |getcursorcharpos()| and
|getpos()|.
The first "bufnum" item is always zero. The byte position of
the cursor is returned in "col". To get the character
position, use |getcursorcharpos()|.
The optional {winid} argument can specify the window. It can
be the window number or the |window-ID|. The last known
cursor position is returned, this may be invalid for the
current value of the buffer if it is not the current window.
If {winid} is invalid a list with zeroes is returned.
This can be used to save and restore the cursor position: >vim
let save_cursor = getcurpos()
MoveTheCursorAround
call setpos('.', save_cursor)
< Note that this only works within the window. See
|winrestview()| for restoring more state.
Parameters: ~
• {winid} (`integer?`)
Return: ~
(`[integer, integer, integer, integer, integer]`)
getcursorcharpos([{winid}]) *getcursorcharpos()*
Same as |getcurpos()| but the column number in the returned
List is a character index instead of a byte index.
Example:
With the cursor on '보' in line 3 with text "여보세요": >vim
getcursorcharpos() " returns [0, 3, 2, 0, 3]
getcurpos() " returns [0, 3, 4, 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: ~