comparison runtime/doc/usr_41.txt @ 20687:770a8e9c4781 v8.2.0897

patch 8.2.0897: list of functions in patched version is outdated Commit: https://github.com/vim/vim/commit/ebacddbc16b2d76bf5dad636d7ee5c529f0e8753 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 4 15:22:21 2020 +0200 patch 8.2.0897: list of functions in patched version is outdated Problem: List of functions in patched version is outdated. Solution: Update the function lists only.
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Jun 2020 15:30:05 +0200
parents c2beb6baa42c
children a672feb8fc4f
comparison
equal deleted inserted replaced
20686:0034b328ddde 20687:770a8e9c4781
1 *usr_41.txt* For Vim version 8.2. Last change: 2020 Mar 15 1 *usr_41.txt* For Vim version 8.2. Last change: 2020 Jun 01
2 2
3 VIM USER MANUAL - by Bram Moolenaar 3 VIM USER MANUAL - by Bram Moolenaar
4 4
5 Write a Vim script 5 Write a Vim script
6 6
38 prefer. And you can use any colon command in it (commands that start with a 38 prefer. And you can use any colon command in it (commands that start with a
39 ":"; these are sometimes referred to as Ex commands or command-line commands). 39 ":"; these are sometimes referred to as Ex commands or command-line commands).
40 Syntax files are also Vim scripts. As are files that set options for a 40 Syntax files are also Vim scripts. As are files that set options for a
41 specific file type. A complicated macro can be defined by a separate Vim 41 specific file type. A complicated macro can be defined by a separate Vim
42 script file. You can think of other uses yourself. 42 script file. You can think of other uses yourself.
43
44 Note: if you are familiar with Python, you can find a comparison between
45 Python and Vim script here, with pointers to other documents:
46 https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0
47
43 48
44 Let's start with a simple example: > 49 Let's start with a simple example: >
45 50
46 :let i = 1 51 :let i = 1
47 :while i < 5 52 :while i < 5
629 remove() remove one or more items from a List 634 remove() remove one or more items from a List
630 copy() make a shallow copy of a List 635 copy() make a shallow copy of a List
631 deepcopy() make a full copy of a List 636 deepcopy() make a full copy of a List
632 filter() remove selected items from a List 637 filter() remove selected items from a List
633 map() change each List item 638 map() change each List item
639 reduce() reduce a List to a value
634 sort() sort a List 640 sort() sort a List
635 reverse() reverse the order of a List 641 reverse() reverse the order of a List
636 uniq() remove copies of repeated adjacent items 642 uniq() remove copies of repeated adjacent items
637 split() split a String into a List 643 split() split a String into a List
638 join() join List items into a String 644 join() join List items into a String
685 atan() arc tangent 691 atan() arc tangent
686 atan2() arc tangent 692 atan2() arc tangent
687 sinh() hyperbolic sine 693 sinh() hyperbolic sine
688 cosh() hyperbolic cosine 694 cosh() hyperbolic cosine
689 tanh() hyperbolic tangent 695 tanh() hyperbolic tangent
696 isinf() check for infinity
690 isnan() check for not a number 697 isnan() check for not a number
691 698
692 Other computation: *bitwise-function* 699 Other computation: *bitwise-function*
693 and() bitwise AND 700 and() bitwise AND
694 invert() bitwise invert 701 invert() bitwise invert
695 or() bitwise OR 702 or() bitwise OR
696 xor() bitwise XOR 703 xor() bitwise XOR
697 sha256() SHA-256 hash 704 sha256() SHA-256 hash
705 rand() get a pseudo-random number
706 srand() initialize seed used by rand()
698 707
699 Variables: *var-functions* 708 Variables: *var-functions*
700 type() type of a variable 709 type() type of a variable
701 islocked() check if a variable is locked 710 islocked() check if a variable is locked
702 funcref() get a Funcref for a function reference 711 funcref() get a Funcref for a function reference
742 lispindent() indent according to Lisp indenting 751 lispindent() indent according to Lisp indenting
743 nextnonblank() find next non-blank line 752 nextnonblank() find next non-blank line
744 prevnonblank() find previous non-blank line 753 prevnonblank() find previous non-blank line
745 search() find a match for a pattern 754 search() find a match for a pattern
746 searchpos() find a match for a pattern 755 searchpos() find a match for a pattern
756 searchcount() get number of matches before/after the cursor
747 searchpair() find the other end of a start/skip/end 757 searchpair() find the other end of a start/skip/end
748 searchpairpos() find the other end of a start/skip/end 758 searchpairpos() find the other end of a start/skip/end
749 searchdecl() search for the declaration of a name 759 searchdecl() search for the declaration of a name
750 getcharsearch() return character search information 760 getcharsearch() return character search information
751 setcharsearch() set character search information 761 setcharsearch() set character search information
826 listener_add() add a callback to listen to changes 836 listener_add() add a callback to listen to changes
827 listener_flush() invoke listener callbacks 837 listener_flush() invoke listener callbacks
828 listener_remove() remove a listener callback 838 listener_remove() remove a listener callback
829 win_findbuf() find windows containing a buffer 839 win_findbuf() find windows containing a buffer
830 win_getid() get window ID of a window 840 win_getid() get window ID of a window
841 win_gettype() get type of window
831 win_gotoid() go to window with ID 842 win_gotoid() go to window with ID
832 win_id2tabwin() get tab and window nr from window ID 843 win_id2tabwin() get tab and window nr from window ID
833 win_id2win() get window nr from window ID 844 win_id2win() get window nr from window ID
845 win_splitmove() move window to a split of another window
834 getbufinfo() get a list with buffer information 846 getbufinfo() get a list with buffer information
835 gettabinfo() get a list with tab page information 847 gettabinfo() get a list with tab page information
836 getwininfo() get a list with window information 848 getwininfo() get a list with window information
837 getchangelist() get a list of change list entries 849 getchangelist() get a list of change list entries
838 getjumplist() get a list of jump list entries 850 getjumplist() get a list of jump list entries
905 browsedir() put up a directory requester 917 browsedir() put up a directory requester
906 confirm() let the user make a choice 918 confirm() let the user make a choice
907 getchar() get a character from the user 919 getchar() get a character from the user
908 getcharmod() get modifiers for the last typed character 920 getcharmod() get modifiers for the last typed character
909 getmousepos() get last known mouse position 921 getmousepos() get last known mouse position
922 echoraw() output characters as-is
910 feedkeys() put characters in the typeahead queue 923 feedkeys() put characters in the typeahead queue
911 input() get a line from the user 924 input() get a line from the user
912 inputlist() let the user pick an entry from a list 925 inputlist() let the user pick an entry from a list
913 inputsecret() get a line from the user without showing it 926 inputsecret() get a line from the user without showing it
914 inputdialog() get a line from the user in a dialog 927 inputdialog() get a line from the user in a dialog
946 959
947 Mappings and Menus: *mapping-functions* 960 Mappings and Menus: *mapping-functions*
948 hasmapto() check if a mapping exists 961 hasmapto() check if a mapping exists
949 mapcheck() check if a matching mapping exists 962 mapcheck() check if a matching mapping exists
950 maparg() get rhs of a mapping 963 maparg() get rhs of a mapping
964 mapset() restore a mapping
951 menu_info() get information about a menu item 965 menu_info() get information about a menu item
952 wildmenumode() check if the wildmode is active 966 wildmenumode() check if the wildmode is active
953 967
954 Testing: *test-functions* 968 Testing: *test-functions*
955 assert_equal() assert that two expressions values are equal 969 assert_equal() assert that two expressions values are equal
966 assert_report() report a test failure 980 assert_report() report a test failure
967 test_alloc_fail() make memory allocation fail 981 test_alloc_fail() make memory allocation fail
968 test_autochdir() enable 'autochdir' during startup 982 test_autochdir() enable 'autochdir' during startup
969 test_override() test with Vim internal overrides 983 test_override() test with Vim internal overrides
970 test_garbagecollect_now() free memory right now 984 test_garbagecollect_now() free memory right now
985 test_garbagecollect_soon() set a flag to free memory soon
971 test_getvalue() get value of an internal variable 986 test_getvalue() get value of an internal variable
972 test_ignore_error() ignore a specific error message 987 test_ignore_error() ignore a specific error message
973 test_null_blob() return a null Blob 988 test_null_blob() return a null Blob
974 test_null_channel() return a null Channel 989 test_null_channel() return a null Channel
975 test_null_dict() return a null Dict 990 test_null_dict() return a null Dict
991 test_null_function() return a null Funcref
976 test_null_job() return a null Job 992 test_null_job() return a null Job
977 test_null_list() return a null List 993 test_null_list() return a null List
978 test_null_partial() return a null Partial function 994 test_null_partial() return a null Partial function
979 test_null_string() return a null String 995 test_null_string() return a null String
980 test_settime() set the time Vim uses internally 996 test_settime() set the time Vim uses internally
981 test_setmouse() set the mouse position 997 test_setmouse() set the mouse position
982 test_feedinput() add key sequence to input buffer 998 test_feedinput() add key sequence to input buffer
983 test_option_not_set() reset flag indicating option was set 999 test_option_not_set() reset flag indicating option was set
984 test_scrollbar() simulate scrollbar movement in the GUI 1000 test_scrollbar() simulate scrollbar movement in the GUI
1001 test_refcount() return an expression's reference count
1002 test_srand_seed() set the seed value for srand()
1003 test_unknown() return a value with unknown type
1004 test_void() return a value with void type
985 1005
986 Inter-process communication: *channel-functions* 1006 Inter-process communication: *channel-functions*
987 ch_canread() check if there is something to read 1007 ch_canread() check if there is something to read
988 ch_open() open a channel 1008 ch_open() open a channel
989 ch_close() close a channel 1009 ch_close() close a channel
991 ch_read() read a message from a channel 1011 ch_read() read a message from a channel
992 ch_readblob() read a Blob from a channel 1012 ch_readblob() read a Blob from a channel
993 ch_readraw() read a raw message from a channel 1013 ch_readraw() read a raw message from a channel
994 ch_sendexpr() send a JSON message over a channel 1014 ch_sendexpr() send a JSON message over a channel
995 ch_sendraw() send a raw message over a channel 1015 ch_sendraw() send a raw message over a channel
996 ch_evalexpr() evaluates an expression over channel 1016 ch_evalexpr() evaluate an expression over channel
997 ch_evalraw() evaluates a raw string over channel 1017 ch_evalraw() evaluate a raw string over channel
998 ch_status() get status of a channel 1018 ch_status() get status of a channel
999 ch_getbufnr() get the buffer number of a channel 1019 ch_getbufnr() get the buffer number of a channel
1000 ch_getjob() get the job associated with a channel 1020 ch_getjob() get the job associated with a channel
1001 ch_info() get channel information 1021 ch_info() get channel information
1002 ch_log() write a message in the channel log file 1022 ch_log() write a message in the channel log file
1005 json_encode() encode an expression to a JSON string 1025 json_encode() encode an expression to a JSON string
1006 json_decode() decode a JSON string to Vim types 1026 json_decode() decode a JSON string to Vim types
1007 js_encode() encode an expression to a JSON string 1027 js_encode() encode an expression to a JSON string
1008 js_decode() decode a JSON string to Vim types 1028 js_decode() decode a JSON string to Vim types
1009 1029
1010 Jobs: *job-functions* 1030 Jobs: *job-functions*
1011 job_start() start a job 1031 job_start() start a job
1012 job_stop() stop a job 1032 job_stop() stop a job
1013 job_status() get the status of a job 1033 job_status() get the status of a job
1014 job_getchannel() get the channel used by a job 1034 job_getchannel() get the channel used by a job
1015 job_info() get information about a job 1035 job_info() get information about a job
1048 term_dumpload() load a terminal screen dump in a window 1068 term_dumpload() load a terminal screen dump in a window
1049 term_dumpwrite() dump contents of a terminal screen to a file 1069 term_dumpwrite() dump contents of a terminal screen to a file
1050 term_setkill() set signal to stop job in a terminal 1070 term_setkill() set signal to stop job in a terminal
1051 term_setrestore() set command to restore a terminal 1071 term_setrestore() set command to restore a terminal
1052 term_setsize() set the size of a terminal 1072 term_setsize() set the size of a terminal
1073 term_setapi() set terminal JSON API function name prefix
1053 1074
1054 Popup window: *popup-window-functions* 1075 Popup window: *popup-window-functions*
1055 popup_create() create popup centered in the screen 1076 popup_create() create popup centered in the screen
1056 popup_atcursor() create popup just above the cursor position, 1077 popup_atcursor() create popup just above the cursor position,
1057 closes when the cursor moves away 1078 closes when the cursor moves away
1066 popup_setoptions() override options of a popup 1087 popup_setoptions() override options of a popup
1067 popup_settext() replace the popup buffer contents 1088 popup_settext() replace the popup buffer contents
1068 popup_close() close one popup 1089 popup_close() close one popup
1069 popup_clear() close all popups 1090 popup_clear() close all popups
1070 popup_filter_menu() select from a list of items 1091 popup_filter_menu() select from a list of items
1071 popup_filter_yesno() blocks until 'y' or 'n' is pressed 1092 popup_filter_yesno() block until 'y' or 'n' is pressed
1072 popup_getoptions() get current options for a popup 1093 popup_getoptions() get current options for a popup
1073 popup_getpos() get actual position and size of a popup 1094 popup_getpos() get actual position and size of a popup
1095 popup_findinfo() get window ID for popup info window
1096 popup_findpreview() get window ID for popup preview window
1097 popup_list() get list of all popup window IDs
1098 popup_locate() get popup window ID from its screen position
1074 1099
1075 Timers: *timer-functions* 1100 Timers: *timer-functions*
1076 timer_start() create a timer 1101 timer_start() create a timer
1077 timer_pause() pause or unpause a timer 1102 timer_pause() pause or unpause a timer
1078 timer_stop() stop a timer 1103 timer_stop() stop a timer
1088 Prompt Buffer: *promptbuffer-functions* 1113 Prompt Buffer: *promptbuffer-functions*
1089 prompt_setcallback() set prompt callback for a buffer 1114 prompt_setcallback() set prompt callback for a buffer
1090 prompt_setinterrupt() set interrupt callback for a buffer 1115 prompt_setinterrupt() set interrupt callback for a buffer
1091 prompt_setprompt() set the prompt text for a buffer 1116 prompt_setprompt() set the prompt text for a buffer
1092 1117
1118 Text Properties: *text-property-functions*
1119 prop_add() attach a property at a position
1120 prop_clear() remove all properties from a line or lines
1121 prop_find() search for a property
1122 prop_list() return a list of all properties in a line
1123 prop_remove() remove a property from a line
1124 prop_type_add() add/define a property type
1125 prop_type_change() change properties of a type
1126 prop_type_delete() remove a text property type
1127 prop_type_get() return the properties of a type
1128 prop_type_list() return a list of all property types
1129
1130 Sound: *sound-functions*
1131 sound_clear() stop playing all sounds
1132 sound_playevent() play an event's sound
1133 sound_playfile() play a sound file
1134 sound_stop() stop playing a sound
1135
1093 Various: *various-functions* 1136 Various: *various-functions*
1094 mode() get current editing mode 1137 mode() get current editing mode
1138 state() get current busy state
1095 visualmode() last visual mode used 1139 visualmode() last visual mode used
1096 exists() check if a variable, function, etc. exists 1140 exists() check if a variable, function, etc. exists
1097 has() check if a feature is supported in Vim 1141 has() check if a feature is supported in Vim
1098 changenr() return number of most recent change 1142 changenr() return number of most recent change
1099 cscope_connection() check if a cscope connection exists 1143 cscope_connection() check if a cscope connection exists
1100 did_filetype() check if a FileType autocommand was used 1144 did_filetype() check if a FileType autocommand was used
1101 eventhandler() check if invoked by an event handler 1145 eventhandler() check if invoked by an event handler
1102 getpid() get process ID of Vim 1146 getpid() get process ID of Vim
1147 getimstatus() check if IME status is active
1148 interrupt() interrupt script execution
1149 windowsversion() get MS-Windows version
1103 1150
1104 libcall() call a function in an external library 1151 libcall() call a function in an external library
1105 libcallnr() idem, returning a number 1152 libcallnr() idem, returning a number
1106 1153
1107 undofile() get the name of the undo file 1154 undofile() get the name of the undo file
1115 1162
1116 shiftwidth() effective value of 'shiftwidth' 1163 shiftwidth() effective value of 'shiftwidth'
1117 1164
1118 wordcount() get byte/word/char count of buffer 1165 wordcount() get byte/word/char count of buffer
1119 1166
1120 luaeval() evaluate Lua expression 1167 luaeval() evaluate |Lua| expression
1121 mzeval() evaluate |MzScheme| expression 1168 mzeval() evaluate |MzScheme| expression
1122 perleval() evaluate Perl expression (|+perl|) 1169 perleval() evaluate Perl expression (|+perl|)
1123 py3eval() evaluate Python expression (|+python3|) 1170 py3eval() evaluate Python expression (|+python3|)
1124 pyeval() evaluate Python expression (|+python|) 1171 pyeval() evaluate Python expression (|+python|)
1125 pyxeval() evaluate |python_x| expression 1172 pyxeval() evaluate |python_x| expression
1173 rubyeval() evaluate |Ruby| expression
1174
1126 debugbreak() interrupt a program being debugged 1175 debugbreak() interrupt a program being debugged
1127 1176
1128 ============================================================================== 1177 ==============================================================================
1129 *41.7* Defining a function 1178 *41.7* Defining a function
1130 1179