|
6 | 6 |
|
7 | 7 | Builtin functions *builtin-functions*
|
8 | 8 |
|
9 |
| -Note: Expression evaluation can be disabled at compile time. If this has been |
10 |
| -done, the builtin functions are not available. See |+eval| and |
11 |
| -|no-eval-feature|. |
| 9 | +Note: Expression evaluation can be disabled at compile time, the builtin |
| 10 | +functions are not available then. See |+eval| and |no-eval-feature|. |
| 11 | + |
| 12 | +For functions grouped by what they are used for see |function-list|. |
12 | 13 |
|
13 | 14 | 1. Overview |builtin-function-list|
|
14 | 15 | 2. Details |builtin-function-details|
|
@@ -60,6 +61,9 @@ assert_report({msg}) Number report a test failure
|
60 | 61 | assert_true({actual} [, {msg}]) Number assert {actual} is true
|
61 | 62 | atan({expr}) Float arc tangent of {expr}
|
62 | 63 | atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
|
| 64 | +autocmd_add({acmds}) Bool add a list of autocmds and groups |
| 65 | +autocmd_delete({acmds}) Bool delete a list of autocmds and groups |
| 66 | +autocmd_get([{opts}]) List return a list of autocmds |
63 | 67 | balloon_gettext() String current text in the balloon
|
64 | 68 | balloon_show({expr}) none show {expr} inside the balloon
|
65 | 69 | balloon_split({msg}) List split {msg} as used for a balloon
|
@@ -921,9 +925,159 @@ atan2({expr1}, {expr2}) *atan2()*
|
921 | 925 |
|
922 | 926 | Can also be used as a |method|: >
|
923 | 927 | Compute()->atan2(1)
|
924 |
| -< |
925 |
| - {only available when compiled with the |+float| feature} |
926 | 928 |
|
| 929 | +
|
| 930 | +autocmd_add({acmds}) *autocmd_add()* |
| 931 | + Adds a List of autocmds and autocmd groups. |
| 932 | + |
| 933 | + The {acmds} argument is a List where each item is a Dict with |
| 934 | + the following optional items: |
| 935 | + bufnr buffer number to add a buffer-local autocmd. |
| 936 | + If this item is specified, then the "pattern" |
| 937 | + item is ignored. |
| 938 | + cmd Ex command to execute for this autocmd event |
| 939 | + event autocmd event name. Refer to |autocmd-events|. |
| 940 | + This can be either a String with a single |
| 941 | + event name or a List of event names. |
| 942 | + group autocmd group name. Refer to |autocmd-groups|. |
| 943 | + If this group doesn't exist then it is |
| 944 | + created. If not specified or empty, then the |
| 945 | + default group is used. |
| 946 | + nested boolean flag, set to v:true to add a nested |
| 947 | + autocmd. Refer to |autocmd-nested|. |
| 948 | + once boolean flag, set to v:true to add an autocmd |
| 949 | + which executes only once. Refer to |
| 950 | + |autocmd-once|. |
| 951 | + pattern autocmd pattern string. Refer to |
| 952 | + |autocmd-patterns|. If "bufnr" item is |
| 953 | + present, then this item is ignored. This can |
| 954 | + be a String with a single pattern or a List of |
| 955 | + patterns. |
| 956 | + replace boolean flag, set to v:true to remove all the |
| 957 | + commands associated with the specified autocmd |
| 958 | + event and group and add the {cmd}. This is |
| 959 | + useful to avoid adding the same command |
| 960 | + multiple times for an autocmd event in a group. |
| 961 | + |
| 962 | + Returns v:true on success and v:false on failure. |
| 963 | + Examples: > |
| 964 | + " Create a buffer-local autocmd for buffer 5 |
| 965 | + let acmd = {} |
| 966 | + let acmd.group = 'MyGroup' |
| 967 | + let acmd.event = 'BufEnter' |
| 968 | + let acmd.bufnr = 5 |
| 969 | + let acmd.cmd = 'call BufEnterFunc()' |
| 970 | + call autocmd_add([acmd]) |
| 971 | +< |
| 972 | + Can also be used as a |method|: > |
| 973 | + GetAutocmdList()->autocmd_add() |
| 974 | +< |
| 975 | +autocmd_delete({acmds}) *autocmd_delete()* |
| 976 | + Deletes a List of autocmds and autocmd groups. |
| 977 | + |
| 978 | + The {acmds} argument is a List where each item is a Dict with |
| 979 | + the following optional items: |
| 980 | + bufnr buffer number to delete a buffer-local autocmd. |
| 981 | + If this item is specified, then the "pattern" |
| 982 | + item is ignored. |
| 983 | + cmd Ex command for this autocmd event |
| 984 | + event autocmd event name. Refer to |autocmd-events|. |
| 985 | + If '*' then all the autocmd events in this |
| 986 | + group are deleted. |
| 987 | + group autocmd group name. Refer to |autocmd-groups|. |
| 988 | + If not specified or empty, then the default |
| 989 | + group is used. |
| 990 | + nested set to v:true for a nested autocmd. |
| 991 | + Refer to |autocmd-nested|. |
| 992 | + once set to v:true for an autocmd which executes |
| 993 | + only once. Refer to |autocmd-once|. |
| 994 | + pattern autocmd pattern string. Refer to |
| 995 | + |autocmd-patterns|. If "bufnr" item is |
| 996 | + present, then this item is ignored. |
| 997 | + |
| 998 | + If only {group} is specified in a {acmds} entry and {event}, |
| 999 | + {pattern} and {cmd} are not specified, then that autocmd group |
| 1000 | + is deleted. |
| 1001 | + |
| 1002 | + Returns |v:true| on success and |v:false| on failure. |
| 1003 | + Examples: > |
| 1004 | + " :autocmd! BufLeave *.vim |
| 1005 | + let acmd = #{event: 'BufLeave', pattern: '*.vim'} |
| 1006 | + call autocmd_delete([acmd]}) |
| 1007 | + " :autocmd! MyGroup1 BufLeave |
| 1008 | + let acmd = #{group: 'MyGroup1', event: 'BufLeave'} |
| 1009 | + call autocmd_delete([acmd]) |
| 1010 | + " :autocmd! MyGroup2 BufEnter *.c |
| 1011 | + let acmd = #{group: 'MyGroup2', event: 'BufEnter', |
| 1012 | + \ pattern: '*.c'} |
| 1013 | + " :autocmd! MyGroup2 * *.c |
| 1014 | + let acmd = #{group: 'MyGroup2', event: '*', |
| 1015 | + \ pattern: '*.c'} |
| 1016 | + call autocmd_delete([acmd]) |
| 1017 | + " :autocmd! MyGroup3 |
| 1018 | + let acmd = #{group: 'MyGroup3'} |
| 1019 | + call autocmd_delete([acmd]) |
| 1020 | +< |
| 1021 | + Can also be used as a |method|: > |
| 1022 | + GetAutocmdList()->autocmd_delete() |
| 1023 | +
|
| 1024 | +autocmd_get([{opts}]) *autocmd_get()* |
| 1025 | + Returns a |List| of autocmds. If {opts} is not supplied, then |
| 1026 | + returns the autocmds for all the events in all the groups. |
| 1027 | + |
| 1028 | + The optional {opts} Dict argument supports the following |
| 1029 | + items: |
| 1030 | + group Autocmd group name. If specified, returns only |
| 1031 | + the autocmds defined in this group. If the |
| 1032 | + specified group doesn't exist, results in an |
| 1033 | + error message. If set to an empty string, |
| 1034 | + then the default autocmd group is used. |
| 1035 | + event Autocmd event name. If specified, returns only |
| 1036 | + the autocmds defined for this event. If set |
| 1037 | + to "*", then returns autocmds for all the |
| 1038 | + events. If the specified event doesn't exist, |
| 1039 | + results in an error message. |
| 1040 | + pattern Autocmd pattern. If specified, returns only |
| 1041 | + the autocmds defined for this pattern. |
| 1042 | + A combination of the above three times can be supplied in |
| 1043 | + {opts}. |
| 1044 | + |
| 1045 | + Each Dict in the returned List contains the following items: |
| 1046 | + bufnr For buffer-local autocmds, buffer number where |
| 1047 | + the autocmd is defined. |
| 1048 | + cmd Command executed for this autocmd. |
| 1049 | + event Autocmd event name. |
| 1050 | + group Autocmd group name. |
| 1051 | + nested Boolean flag, set to v:true for a nested |
| 1052 | + autocmd. See |autocmd-nested|. |
| 1053 | + once Boolean flag, set to v:true, if the autocmd |
| 1054 | + will be executed only once. See |autocmd-once|. |
| 1055 | + pattern Autocmd pattern. For a buffer-local |
| 1056 | + autocmd, this will be of the form "<buffer=n>". |
| 1057 | + If there are multiple commands for an autocmd event in a |
| 1058 | + group, then separate items are returned for each command. |
| 1059 | + |
| 1060 | + Returns an empty List if an autocmd with the specified group |
| 1061 | + or event or pattern is not found. |
| 1062 | + |
| 1063 | + Examples: > |
| 1064 | + " :autocmd MyGroup |
| 1065 | + echo autocmd_get(#{group: 'Mygroup'}) |
| 1066 | + " :autocmd G BufUnload |
| 1067 | + echo autocmd_get(#{group: 'G', event: 'BufUnload'}) |
| 1068 | + " :autocmd G * *.ts |
| 1069 | + let acmd = #{group: 'G', event: '*', pattern: '*.ts'} |
| 1070 | + echo autocmd_get(acmd) |
| 1071 | + " :autocmd Syntax |
| 1072 | + echo autocmd_get(#{event: 'Syntax'}) |
| 1073 | + " :autocmd G BufEnter *.ts |
| 1074 | + let acmd = #{group: 'G', event: 'BufEnter', |
| 1075 | + \ pattern: '*.ts'} |
| 1076 | + echo autocmd_get(acmd) |
| 1077 | +< |
| 1078 | + Can also be used as a |method|: > |
| 1079 | + Getopts()->autocmd_get() |
| 1080 | +< |
927 | 1081 | balloon_gettext() *balloon_gettext()*
|
928 | 1082 | Return the current text in the balloon. Only for the string,
|
929 | 1083 | not used for the List.
|
|
0 commit comments