comparison runtime/doc/eval.txt @ 2280:941ff1cd317a vim73

Add file save counter to undo information. Add undotree() function.
author Bram Moolenaar <bram@vim.org>
date Sun, 27 Jun 2010 01:15:55 +0200
parents a0b5918c33cc
children e41433ea71df
comparison
equal deleted inserted replaced
2279:420f001db3d2 2280:941ff1cd317a
1942 tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} 1942 tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
1943 to chars in {tostr} 1943 to chars in {tostr}
1944 trunc( {expr} Float truncate Float {expr} 1944 trunc( {expr} Float truncate Float {expr}
1945 type( {name}) Number type of variable {name} 1945 type( {name}) Number type of variable {name}
1946 undofile( {name}) String undo file name for {name} 1946 undofile( {name}) String undo file name for {name}
1947 undotree() List undo file tree
1947 values( {dict}) List values in {dict} 1948 values( {dict}) List values in {dict}
1948 virtcol( {expr}) Number screen column of cursor or mark 1949 virtcol( {expr}) Number screen column of cursor or mark
1949 visualmode( [expr]) String last visual mode used 1950 visualmode( [expr]) String last visual mode used
1950 winbufnr( {nr}) Number buffer number of window {nr} 1951 winbufnr( {nr}) Number buffer number of window {nr}
1951 wincol() Number window column of the cursor 1952 wincol() Number window column of the cursor
2347 Confirm() offers the user a dialog, from which a choice can be 2348 Confirm() offers the user a dialog, from which a choice can be
2348 made. It returns the number of the choice. For the first 2349 made. It returns the number of the choice. For the first
2349 choice this is 1. 2350 choice this is 1.
2350 Note: confirm() is only supported when compiled with dialog 2351 Note: confirm() is only supported when compiled with dialog
2351 support, see |+dialog_con| and |+dialog_gui|. 2352 support, see |+dialog_con| and |+dialog_gui|.
2353
2352 {msg} is displayed in a |dialog| with {choices} as the 2354 {msg} is displayed in a |dialog| with {choices} as the
2353 alternatives. When {choices} is missing or empty, "&OK" is 2355 alternatives. When {choices} is missing or empty, "&OK" is
2354 used (and translated). 2356 used (and translated).
2355 {msg} is a String, use '\n' to include a newline. Only on 2357 {msg} is a String, use '\n' to include a newline. Only on
2356 some systems the string is wrapped when it doesn't fit. 2358 some systems the string is wrapped when it doesn't fit.
2359
2357 {choices} is a String, with the individual choices separated 2360 {choices} is a String, with the individual choices separated
2358 by '\n', e.g. > 2361 by '\n', e.g. >
2359 confirm("Save changes?", "&Yes\n&No\n&Cancel") 2362 confirm("Save changes?", "&Yes\n&No\n&Cancel")
2360 < The letter after the '&' is the shortcut key for that choice. 2363 < The letter after the '&' is the shortcut key for that choice.
2361 Thus you can type 'c' to select "Cancel". The shortcut does 2364 Thus you can type 'c' to select "Cancel". The shortcut does
2362 not need to be the first letter: > 2365 not need to be the first letter: >
2363 confirm("file has been modified", "&Save\nSave &All") 2366 confirm("file has been modified", "&Save\nSave &All")
2364 < For the console, the first letter of each choice is used as 2367 < For the console, the first letter of each choice is used as
2365 the default shortcut key. 2368 the default shortcut key.
2369
2366 The optional {default} argument is the number of the choice 2370 The optional {default} argument is the number of the choice
2367 that is made if the user hits <CR>. Use 1 to make the first 2371 that is made if the user hits <CR>. Use 1 to make the first
2368 choice the default one. Use 0 to not set a default. If 2372 choice the default one. Use 0 to not set a default. If
2369 {default} is omitted, 1 is used. 2373 {default} is omitted, 1 is used.
2370 The optional {type} argument gives the type of dialog. This 2374
2371 is only used for the icon of the Win32 GUI. It can be one of 2375 The optional {type} argument gives the type of dialog. This
2372 these values: "Error", "Question", "Info", "Warning" or 2376 is only used for the icon of the GTK, Mac, Motif and Win32
2373 "Generic". Only the first character is relevant. When {type} 2377 GUI. It can be one of these values: "Error", "Question",
2374 is omitted, "Generic" is used. 2378 "Info", "Warning" or "Generic". Only the first character is
2379 relevant. When {type} is omitted, "Generic" is used.
2380
2375 If the user aborts the dialog by pressing <Esc>, CTRL-C, 2381 If the user aborts the dialog by pressing <Esc>, CTRL-C,
2376 or another valid interrupt key, confirm() returns 0. 2382 or another valid interrupt key, confirm() returns 0.
2377 2383
2378 An example: > 2384 An example: >
2379 :let choice = confirm("What do you want?", "&Apples\n&Oranges\n&Bananas", 2) 2385 :let choice = confirm("What do you want?", "&Apples\n&Oranges\n&Bananas", 2)
5776 {name} is always expanded to the full path, since that is what 5782 {name} is always expanded to the full path, since that is what
5777 is used internally. 5783 is used internally.
5778 Useful in combination with |:wundo| and |:rundo|. 5784 Useful in combination with |:wundo| and |:rundo|.
5779 When compiled without the +persistent_undo option this always 5785 When compiled without the +persistent_undo option this always
5780 returns an empty string. 5786 returns an empty string.
5787
5788 undotree() *undotree()*
5789 Return the current state of the undo tree in a dictionary with
5790 the following items:
5791 "seq_last" The highest undo sequence number used.
5792 "seq_cur" The sequence number of the current position in
5793 the undo tree. This differs from "seq_last"
5794 when some changes were undone.
5795 "time_cur" Time last used for |:earlier| and related
5796 commands. Use |strftime()| to convert to
5797 something readable.
5798 "save_last" Number of the last file write. Zero when no
5799 write yet.
5800 "synced" Non-zero when the last undo block was synced.
5801 This happens when waiting from input from the
5802 user. See |undo-blocks|.
5803 "entries" A list of dictionaries with information about
5804 undo blocks.
5805
5806 The first item in the "entries" list is the oldest undo item.
5807 Each List item is a Dictionary with these items:
5808 "seq" Undo sequence number. Same as what appears in
5809 |:undolist|.
5810 "time" Timestamp when the change happened. Use
5811 |strftime()| to convert to something readable.
5812 "newhead" Only appears in the item that is the last one
5813 that was added. This marks the last change
5814 and where further changes will be added.
5815 "curhead" Only appears in the item that is the last one
5816 that was undone. This marks the current
5817 position in the undo tree, the block that will
5818 be used by a redo command. When nothing was
5819 undone after the last change this item will
5820 not appear anywhere.
5821 "save" Only appears on the last block before a file
5822 write. The number is the write count. The
5823 first write has number 1, the last one the
5824 "save_last" mentioned above.
5825 "alt" Alternate entry. This is again a List of undo
5826 blocks. Each item may again have an "alt"
5827 item.
5781 5828
5782 values({dict}) *values()* 5829 values({dict}) *values()*
5783 Return a |List| with all the values of {dict}. The |List| is 5830 Return a |List| with all the values of {dict}. The |List| is
5784 in arbitrary order. 5831 in arbitrary order.
5785 5832