comparison runtime/doc/usr_41.txt @ 112:195c94b60e54

updated for version 7.0041
author vimboss
date Mon, 17 Jan 2005 22:11:23 +0000
parents 00c35ea0c2b3
children 2983cde45542
comparison
equal deleted inserted replaced
111:a3d7e800ddec 112:195c94b60e54
1 *usr_41.txt* For Vim version 7.0aa. Last change: 2005 Jan 01 1 *usr_41.txt* For Vim version 7.0aa. Last change: 2005 Jan 17
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
85 If you happen to write a while loop that keeps on running, you can 85 If you happen to write a while loop that keeps on running, you can
86 interrupt it by pressing CTRL-C (CTRL-Break on MS-Windows). 86 interrupt it by pressing CTRL-C (CTRL-Break on MS-Windows).
87 Note: 87 Note:
88 You can try out the examples by yanking the lines from the text here 88 You can try out the examples by yanking the lines from the text here
89 and executing them with :@" 89 and executing them with :@"
90
91 The example was given to explain the commands, but you would really want to
92 make such a loop it can be written much more compact: >
93
94 :for i in range(1, 4)
95 : echo "count is" i
96 :endfor
97
98 We won't explain how |:for| and |range()| work right now. Follow the links if
99 you are impatient.
90 100
91 101
92 THREE KINDS OF NUMBERS 102 THREE KINDS OF NUMBERS
93 103
94 Numbers can be decimal, hexadecimal or octal. A hexadecimal number starts 104 Numbers can be decimal, hexadecimal or octal. A hexadecimal number starts
557 submatch() get a specific match in a ":substitute" 567 submatch() get a specific match in a ":substitute"
558 strpart() get part of a string 568 strpart() get part of a string
559 expand() expand special keywords 569 expand() expand special keywords
560 type() type of a variable 570 type() type of a variable
561 iconv() convert text from one encoding to another 571 iconv() convert text from one encoding to another
572
573 List manipulation:
574 get() get an item without error for wrong index
575 len() number of items in a List
576 empty() check if List is empty
577 insert() insert an item somewhere in a List
578 add() append an item to a List
579 extend() append a List to a List
580 remove() remove one or more items from a List
581 copy() make a shallow copy of a List
582 deepcopy() make a full copy of a List
583 filter() remove selected items from a List
584 map() change each List item
585 sort() sort a List
586 reverse() reverse the order of a List
587 split() split a String into a List
588 join() join List items into a String
589 string() String representation of a List
590 call() call a function with List as arguments
591 max() maximum value in a List
592 min() minimum value in a List
593 count() count number of times a value appears in a List
594 getline() get List with buffer lines
595 append() append List of lines to the buffer
596
597 Dictionary manipulation:
598 get() get an entries without error for wrong key
599 len() number of entries in a Dictionary
600 has_key() check whether a key appears in a Dictionary
601 empty() check if Dictionary is empty
602 remove() remove an entry from a Dictionary
603 extend() add entries from one Dictionary to another
604 filter() remove selected entries from a Dictionary
605 map() change each Dictionary entry
606 keys() get List of Dictionary keys
607 values() get List of Dictionary values
608 items() get List of Dictionary key-value pairs
609 copy() make a shallow copy of a Dictionary
610 deepcopy() make a full copy of a Dictionary
611 string() String representation of a Dictionary
612 max() maximum value in a Dictionary
613 min() minimum value in a Dictionary
614 count() count number of times a value appears
562 615
563 Working with text in the current buffer: 616 Working with text in the current buffer:
564 byte2line() get line number at a specific byte count 617 byte2line() get line number at a specific byte count
565 line2byte() byte count at a specific line 618 line2byte() byte count at a specific line
566 col() column number of the cursor or a mark 619 col() column number of the cursor or a mark