updated for version 7.0048

This commit is contained in:
Bram Moolenaar
2005-02-05 21:39:53 +00:00
parent 8089cae03b
commit 3a7c85bc13
10 changed files with 191 additions and 55 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2005 Feb 02
*eval.txt* For Vim version 7.0aa. Last change: 2005 Feb 05
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1476,6 +1476,8 @@ match( {expr}, {pat}[, {start}[, {count}]])
Number position where {pat} matches in {expr}
matchend( {expr}, {pat}[, {start}[, {count}]])
Number position where {pat} ends in {expr}
matchlist( {expr}, {pat}[, {start}[, {count}]])
List match and submatches of {pat} in {expr}
matchstr( {expr}, {pat}[, {start}[, {count}]])
String {count}'th match of {pat} in {expr}
max({list}) Number maximum value of items in {list}
@ -1486,6 +1488,7 @@ nr2char( {expr}) String single char with ASCII value {expr}
prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum}
range( {expr} [, {max} [, {stride}]])
List items from {expr} to {max}
readfile({fname} [, {binary}]) List get list of lines from file {fname}
remote_expr( {server}, {string} [, {idvar}])
String send expression
remote_foreground( {server}) Number bring Vim server to the foreground
@ -1548,6 +1551,8 @@ winline() Number window line of the cursor
winnr() Number number of current window
winrestcmd() String returns command to restore window sizes
winwidth( {nr}) Number width of window {nr}
writefile({list}, {fname} [, {binary}])
Number write list of lines to file {fname}
add({list}, {expr}) *add()*
Append the item {expr} to List {list}. Returns the resulting
@ -2004,8 +2009,12 @@ exists({expr}) The result is a Number, which is non-zero if {expr} is
or user defined function (see
|user-functions|).
varname internal variable (see
|internal-variables|). Does not work
for |curly-braces-names|.
|internal-variables|). Also works
for |curly-braces-names|, Dictionary
entries, List items, etc. Beware that
this may cause functions to be
invoked cause an error message for an
invalid expression.
:cmdname Ex command: built-in command, user
command or command modifier |:command|.
Returns:
@ -2939,9 +2948,10 @@ map({expr}, {string}) *map()*
:call map(mylist, '"> " . v:val . " <"')
< This puts "> " before and " <" after each item in "mylist".
Note that {string} is the result of expression and is then
Note that {string} is the result of an expression and is then
used as an expression again. Often it is good to use a
|literal-string| to avoid having to double backslashes.
|literal-string| to avoid having to double backslashes. You
still have to double ' quotes
The operation is done in-place. If you want a List or
Dictionary to remain unmodified make a copy first: >
@ -3050,6 +3060,13 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()*
< result is "-1".
When {expr} is a List the result is equal to match().
matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()*
Same as match(), but return a List. The first item in the
list is the matched string, same as what matchstr() would
return. Following items are submatches, like "\1", "\2", etc.
in |:substitute|.
When there is no match an empty list is returned.
matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
Same as match(), but return the matched string. Example: >
:echo matchstr("testing", "ing")
@ -3133,6 +3150,27 @@ range({expr} [, {max} [, {stride}]]) *range()*
range(2, 9, 3) " [2, 5, 8]
range(2, -2, -1) " [2, 1, 0, -1, -2]
<
*readfile()*
readfile({fname} [, {binary}])
Read file {fname} and return a List, each line of the file as
an item. Lines broken at NL characters. Macintosh files
separated with CR will result in a single long line (unless a
NL appears somewhere).
When {binary} is equal to "b" binary mode is used:
- When the last line ends in a NL an extra empty list item is
added.
- No CR characters are removed.
Otherwise:
- CR characters that appear before a NL are removed.
- Whether the last line ends in a NL or not does not matter.
All NUL characters are replaced with a NL character.
Note that the whole file is read into memory and there is no
recognition of encoding. Read a file into a buffer if you
need to.
When the file can't be opened an error message is given and
the result is an empty list.
Also see |writefile()|.
*remote_expr()* *E449*
remote_expr({server}, {string} [, {idvar}])
Send the {string} to {server}. The string is sent as an
@ -3879,6 +3917,26 @@ winwidth({nr}) *winwidth()*
: exe "normal 50\<C-W>|"
:endif
<
*writefile()*
writefile({list}, {fname} [, {binary}])
Write List {list} to file {fname}. Each list item is
separated with a NL. Each list item must be a String or
Number.
When {binary} is equal to "b" binary mode is used: There will
not be a NL after the last list item. An empty item at the
end does cause the last line in the file to end in a NL.
All NL characters are replaced with a NUL character.
Inserting CR characters needs to be done before passing {list}
to writefile().
An existing file is overwritten, if possible.
When the write fails -1 is returned, otherwise 0. There is an
error message if the file can't be created or when writing
fails.
Also see |readfile()|.
To copy a file byte for byte: >
:let fl = readfile("foo", "b")
:call writefile(fl, "foocopy", "b")
<
*feature-list*
There are three types of features:
@ -4597,7 +4655,7 @@ This would call the function "my_func_whizz(parameter)".
:for {var} in {list} *:for* *E690* *E732*
:endfo[r] *:endfo* *:endfor*
Repeat the commands between ":for" and ":endfor" for
each item in {list}. variable {var} is set to the
each item in {list}. Variable {var} is set to the
value of each item.
When an error is detected for a command inside the
loop, execution continues after the "endfor".

View File

@ -5937,6 +5937,7 @@ rcp pi_netrw.txt /*rcp*
read-messages insert.txt /*read-messages*
read-only-share editing.txt /*read-only-share*
read-stdin version5.txt /*read-stdin*
readfile() eval.txt /*readfile()*
readline-syntax syntax.txt /*readline-syntax*
readline.vim syntax.txt /*readline.vim*
recording repeat.txt /*recording*
@ -6863,6 +6864,7 @@ write-local-help usr_41.txt /*write-local-help*
write-plugin usr_41.txt /*write-plugin*
write-quit editing.txt /*write-quit*
write-readonly editing.txt /*write-readonly*
writefile() eval.txt /*writefile()*
writing editing.txt /*writing*
www intro.txt /*www*
x change.txt /*x*

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Jan 25
*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Feb 04
VIM USER MANUAL - by Bram Moolenaar
@ -653,6 +653,8 @@ System functions and manipulation of files:
rename() rename a file
system() get the result of a shell command
hostname() name of the system
readfile() read a file into a List of lines
writefile() write a List of lines into a file
Buffers, windows and the argument list:
argc() number of entries in the argument list

View File

@ -2,7 +2,7 @@
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Jan 30
" Last Change: 2005 Feb 03
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
" in all modes and avoid side effects from mappings defined by the user.
@ -136,7 +136,7 @@ an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
" the right position, also for "gi".
" Note: the same stuff appears in mswin.vim.
if has("virtualedit")
nnoremap <silent> <script> <SID>Paste :call <SID>Paste()<CR>
let s:paste_cmd = ":call <SID>Paste()<CR>"
func! <SID>Paste()
let ove = &ve
set ve=all
@ -152,16 +152,17 @@ if has("virtualedit")
let &ve = ove
endfunc
else
nnoremap <silent> <script> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
let s:paste_cmd = "\"=@+.'xy'<CR>gPFx\"_2x"
endif
" Use maps for items that are present both in Edit, Popup and Toolbar menu.
" Define the string to use for items that are present both in Edit, Popup and
" Toolbar menu.
if has("virtualedit")
vnoremap <script> <SID>vPaste "-c<Esc><SID>Paste
inoremap <script> <SID>iPaste <Esc><SID>Pastegi
let s:paste_v_cmd = '"-c<Esc>' . s:paste_cmd
let s:paste_i_cmd = '<Esc>' . s:paste_cmd . 'gi'
else
vnoremap <script> <SID>vPaste "-c<Esc>gix<Esc><SID>Paste"_x
inoremap <script> <SID>iPaste x<Esc><SID>Paste"_s
let s:paste_v_cmd = '"-c<Esc>gix<Esc>' . s:paste_cmd . '"_x'
let s:paste_i_cmd = 'x<Esc>' . s:paste_cmd . '"_s'
endif
func! <SID>SelectAll()
@ -180,8 +181,8 @@ vnoremenu 20.350 &Edit.&Copy<Tab>"+y "+y
cnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-Y>
nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP
cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+
vnoremenu <script> &Edit.&Paste<Tab>"+gP <SID>vPaste
inoremenu <script> &Edit.&Paste<Tab>"+gP <SID>iPaste
exe 'vnoremenu <script> &Edit.&Paste<Tab>"+gP ' . s:paste_v_cmd
exe 'inoremenu <script> &Edit.&Paste<Tab>"+gP ' . s:paste_i_cmd
nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p
inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p
nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p
@ -781,8 +782,8 @@ vnoremenu 1.30 PopUp.&Copy "+y
cnoremenu 1.30 PopUp.&Copy <C-Y>
nnoremenu 1.40 PopUp.&Paste "+gP
cnoremenu 1.40 PopUp.&Paste <C-R>+
vnoremenu <script> 1.40 PopUp.&Paste <SID>vPaste
inoremenu <script> 1.40 PopUp.&Paste <SID>iPaste
exe 'vnoremenu <script> 1.40 PopUp.&Paste ' . s:paste_v_cmd
exe 'inoremenu <script> 1.40 PopUp.&Paste ' . s:paste_i_cmd
vnoremenu 1.50 PopUp.&Delete x
an 1.55 PopUp.-SEP2- <Nop>
vnoremenu 1.60 PopUp.Select\ Blockwise <C-V>
@ -848,8 +849,8 @@ if has("toolbar")
cnoremenu 1.80 ToolBar.Copy <C-Y>
nnoremenu 1.90 ToolBar.Paste "+gP
cnoremenu ToolBar.Paste <C-R>+
vnoremenu <script> ToolBar.Paste <SID>vPaste
inoremenu <script> ToolBar.Paste <SID>iPaste
exe 'vnoremenu <script> ToolBar.Paste ' . s:paste_v_cmd
exe 'inoremenu <script> ToolBar.Paste ' . s:paste_i_cmd
if !has("gui_athena")
an 1.95 ToolBar.-sep3- <Nop>
@ -996,6 +997,8 @@ an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR>
endif " !exists("did_install_syntax_menu")
unlet! s:paste_i_cmd s:paste_v_cmd s:paste_cmd
" Restore the previous value of 'cpoptions'.
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -11,11 +11,24 @@
#
# Neil Schemenauer <nascheme@ucalgary.ca>
# March 1999
#
# Safe method for the temp file by Javier Fern<72>ndez-Sanguino_Pe<50>a
INFILE=$1
OUTFILE=/tmp/vimspell.$$
# if you have "tempfile", use the following line
#OUTFILE=`tempfile`
tmp="${TMPDIR-/tmp}"
OUTFILE=`mktemp -t vimspellXXXXXX || tempfile -p vimspell || echo none`
# If the standard commands failed then create the file
# since we cannot create a directory (we cannot remove it on exit)
# create a file in the safest way possible.
if test "$OUTFILE" = none; then
OUTFILE=$tmp/vimspell$$
[ -e $OUTFILE ] && { echo "Cannot use temporary file $OUTFILE, it already exists!; exit 1 ; }
(umask 077; touch $OUTFILE)
fi
# Note the copy of vimspell cannot be deleted on exit since it is
# used by vim, otherwise it should do this:
# trap "rm -f $OUTFILE" 0 1 2 3 9 11 13 15
#
# local spellings